validation - How can I get the HTML5 validity state of an input text box? -


how can retrieve html 5 'validity' status of text box?

for instance, have text input type="email". when user enters wrong value, text box shows red border (in firefox browser).

how can check 'validity-state' of input box?

you can use validity property:

var isvalid = document.getelementbyid('email').validity.valid; 

or checkvalidity() method:

var isvalid = document.getelementbyid('email').checkvalidity(); 

demo | reference.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -