I have multiple forms on a single page with the same named variables within each form.
I need to be able to changed the specific values for one form but not the others.
Ie.
I want to be able to set the value of Var2 for form2, but not the values of Var2 for form1.
Any ideas?
Thanks
Ideally, give the forms their own IDs and use the Descendant Selector:
$("#form1 input[name=foo]").val("something");
or select it by the order in which it appears in the DOM using eq (as Alxandr points out):
$("form:eq(0) input[name=foo]").val("something"); // select the first form
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With