I have problem to add jQuery to some existing code, please help.
We have the same form (same form name, same fields, same submit button, no id or class defined for the form) appeared couple of times on a page, now I need to validation the form with jQuery, without passing in the form object, can jQuery tell which form was submitted?
Thanks everyone for your response, problem solved 🙂
From your question’s comments, it looks like you might need to specify the form’s context along with your selector:
Note that the jquery function takes an optional second argument that is the context of the selection. This should help you find input elements only within your submitted form.
Check the docs here:
http://api.jquery.com/jQuery/#expressioncontext
@NiftyDude’s answer gets at the same issue, though he doesn’t use jquery specifically to get the children of the currently submitting form.