I’m using the jQuery validate plugin. I have this code:
$(".btn-overview-basic-save").click(function(e) {
if (!$('.contact-overview').valid()) {
} else {
alert("invalid")
}
And I’m getting the invalid alert for some reason, even though the form is filled out, and no errors or error markup are showing up. I commented out all of my rules, and I still get it. I tried adding:
errorPlacement: function ($error, $element) {
console.log("error", $error, $element);
}
But nothing shows up in my console.
Short of grabbing a non-minified version of the validate plugin and stepping through, what’s the best way to figure out what’s going on here?
I think this is just the case of some backwards logic. Did you miss the
!in front of.valid()?Remove the
!perhaps?