Thursday, 15 April 2010

jquery - How do you continue firing an event that is trigger by another button. -



jquery - How do you continue firing an event that is trigger by another button. -

so have multiple submit button.

<input type="submit" id="additem" value="add item" action="/additem.php"/> <input type="submit" id="removeitem" value="remove item" action="/removeitem.php/> <input type="button" id="continue" value="continue" style="display:none;/>

and have jquery event

$("#additem").click(function(event) { event.stoppropgation(); $("#continue").show(); });

now when click on go on want able go on firing of additem... (i have more buttons on page, , can't utilize $(this).closest("form") cause not know item pressed.

how this?

you can utilize jquery alter form action. allowing submit different based on add/remove toggle buttons.

var myformaction = ""; $("#additem").click(function(event) { event.stoppropgation(); myformaction = "/additem.php"; $("#continue").show(); }); $("#removeitem").click(function(event) { event.stoppropgation(); myformaction = "/removeitem.php"; $("#continue").show(); }); $("#continue").click(function(event) { //open dialog });

jquery events event-propagation

No comments:

Post a Comment