iPad safari is supposed to be html5 compliant, but it seems that the required element doesn't work. Anyone know why, or have a decent workaround that doesn't require a ton of JavaScript?
My code
<input type=email class=input placeholder="Email" name="email" required>
This is a jQuery solution to the issue, it highlights the input fields that have failed in a pinky colour too.
If you use PHP, you can add a validation like this
You then add this function in php before your form.
If you are already using jQuery, Modernizr, and yepnope, this is one way to deal with it. If you aren't then this will add a lot of extra javascript.
My solution
Since iOS 10.3 this atrributes are supported. Also e-mail type require writing the @ symbol and so on...
I guess you can do something before the submit action like this
after pressing
submit
button,checkValid()
is evoked before it actually submits. a return value oftrue
will continue the submit action.refer to this post for further explanation.:)
It's not supported in iOS yet: when can I use: required.