Reputation: 20409
I have 2 fields in my (simplified) form. And I use jQuery Validate plugin to validate both of them, but only one field is validated - see live example.
What can be wrong here? How to validate both fields?
(there is similar question, but there is no solution)
Upvotes: 0
Views: 218
Reputation: 7879
Your errorPlacement
code is broken. If you remove that, you can see that both fields are validated correctly. You only have one <span>
in your html so .find("span"));
finds that and reports both errors in the same element..
Upvotes: 1
Reputation:
Validation is in fact being performed for both fields - you're just not getting an error message. If you do an inspect element (using Chromium, or Firefox with Firebug), you'll see the input tag will have a class error
.
You're missing the <span></span>
at the end of the div
surrounding the last_name
input field. Add that empty span, and you'll see the error message come up.
Upvotes: 1