Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 Chrome checkValidity onBlur

I'm trying to do a simple checkValidity of a numeric input field on blur, but can't get it to work properly. Does this work in Chrome yet? For instance:

<input onBlur="checkValidity()" type="number" name="x" id="x" min="64" max="2048" value=64>

or

<input onBlur="this.checkValidity()" type="number" name="x" id="x" min="64" max="2048" value=64>

Don't seem to do anything. However, in the console,

$("#x")[0].checkValidity() 

does return true or false based on the current value in the input box and the limits above of (64,2048). Is this broken, or am I doing it wrong?

like image 930
reptilicus Avatar asked Jan 16 '13 04:01

reptilicus


1 Answers

I realize this question is many years old at this point but if anyone else comes across it, the correct way to achieve the behavior that OP wanted appears to be to use onblur="reportValidity()" instead onblur="checkValidity".

like image 158
Dean Brettle Avatar answered Oct 01 '22 23:10

Dean Brettle