Is it possible to check if an input element of an html5 form is valid based on the pattern I set for it? I know the psuedo class stuff.. but i’m hoping something like:
there are two ways to check the validity.
inputElement.validityreturns the validity-state object.
Instead of using keyup, you can also use the ‘input’ event. All browser, which have implemented the constraint validation API, have also implemented the input-event.
If you are using 1. Opera has a bug here and will show its validation hint. So you should use 2.
I have created a html5 forms libary, which implements all unknown features to incapable browsers + fixes issues in HTML5 browsers. So everything works like defined in the spec, but it’s built on top of jquery…. (http://afarkas.github.com/webshim/demos/index.html)
You can use the
It will validate it client side, so no need to validate it again client side.
But, make sure you do it again server side.