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();
Comments
Post a Comment