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?
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"
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With