Can you test if an input element has the CSS3 :valid or :invalid pseudo-class applied to it with jQuery? I would like to test if the form element passed the CSS validation before enabling a submit button.
Things I tried already that did not work:
if($("#el").is(":valid")) {
//...
}
if($("#el:valid").length == 0) {
//...
}
$("#el").attr("valid")
After upgrading to jquery 1.10.2, I can confirm that using the :valid selector now works as expected.
if($("#el").is(":valid")) {
//...
}
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