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 -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -