there are two ways to check the validity.
inputElement.checkValidity()
returns true
or false
inputElement.validity
returns the validity-state object. inputElement.validity.valid
returns true/false
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 option 1 above, Opera has a bug here and will show its validation hint. So you should use 2.
I have created a html5 forms library, 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).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…