I am using the jQuery Validate plugin to validate multiple fields in a table with the same name. Using this answer to another question, the validator nicely validates all the fields, with one issue: the error message stays attached to the first invalid field.
Here is the error placement on the .validate function rules.
errorPlacement: function (error, element) {
error.insertAfter(element.parent());
},
As this codepen I wrote demonstrates, only the first input field with the same name gets an error message
and after the field is filled in, the message remains next to that input field while the error is in another field
even if all input errors are fixed and then the user makes another error, the message stays on that box.
How can I get the validator to put a message on each error, as in the image below?