$('input[type=submit]').click(function(){ $('#clientListForm').attr('action',this.id.substring(7)+'.php'); });
Assumes you're submits have ids with a submit_ prefix followed by the name of the page. On Apr 22, 9:13 am, Thierry <lamthie...@gmail.com> wrote: > I currently have the following legacy piece of html: > > <form action="" method="get" name="clientListForm" > id="clientListForm"> > <input type="submit" name="submit_hello" id="submit_hello" > value="Say Hello" onclick="this.form.action = 'hello.php';"> > <input type="submit" name="submit_hi" id="submit_hi" value="Say > Hi" onclick="this.form.action = 'hi.php';"> > </form> > > The above probably doesn't look too elegant but can someone suggest to > me the best way to initialize this.form.action in jQuery?