I have two forms on my page.
I want to submit one form only.
But when I use the submit button it submits all the forms in that page.
how can I submit a single form with JavaScript?
my code like,
<form name="f1" method='post' action=''>
<input type='submit' value='submit'>
</form>
<form name="f2" method='post' action=''>
<input type='text' name='text2'>
<input type='button' value='submit'>
</form>
You can send the form ID to a Javascript “submitter” function and use it to submit: