I found this tutorial which uses jQuery and validation plugin to validate form input. Please see the working example here.
http://jsfiddle.net/nK7Pw/
This seem to work fine, however I have a question that in the html part, there is no where mentioned error class, then how does the code displays the error just in front of each field? There is no such explanation in the jQuery part too. Thanks for explaining.
I found this tutorial which uses jQuery and validation plugin to validate form input.
Share
It’s all done internally by the validation plugin.
It defines default classes and objects to place in the DOM when an error occurs.
It has an error placement function called internally. It will loop through the error list and then call
showLabelon the element & messageThen it comes along and runs the showLabel function.
If the label already exists Then it will refresh the error class and set the new message in the label.
If it didnt exist then we make one. It has a large constructor block, setting the attribute and the class as well as the message.
It does a bit of extra hackery to for IE to show the label
And right here we have the DOM insertion code.
This has all been pasted from the jQuery.validation source. If something else is unclear feel free to ask. Just searching through the file alone and reading the source should help. I just searched for “error”