function go(button) { $("#my_form").attr("action",button.value); }
and then in your button tag add this onclick='go(this)' cheers Michael Lawson Development Lead, Global Solutions, ibm.com Phone: 1-276-206-8393 E-mail: mjlaw...@us.ibm.com 'Examine my teachings critically, as a gold assayer would test gold. If you find they make sense, conform to your experience, and don't harm yourself or others, only then should you accept them.' From: ciupaz <luigi.zambe...@gmail.com> To: "jQuery (English)" <jquery-en@googlegroups.com> Date: 06/12/2009 10:27 AM Subject: [jQuery] Change form action based on button clicked Hi all, I have a form like this: <form id="my_form" method="post" action=""> Name: <br /> <input type="text" id="name" name="name" /> <input type="submit" id="submit1" value="Go to page 1" /> <input type="submit" id="submit2" value="Go to page 2" /> </form> how can I change my action form so the form goes to Page1.htm with click on button1 and goes to Page2.htm to click on button2, and mantein the value inserted in textbox "name"? Thanks a lot. Luis
<<inline: graycol.gif>>
<<inline: ecblank.gif>>