0

So i 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 than i have a jquery event

$("#addItem").click(function(event) {
     event.stopPropgation();

     $("#continue").show();
 });

Now when i click on continue i want to be able to continue firing of say addItem... (i could have more buttons on that page, and I can't use $(this).closest("form") cause I do not know which item is pressed.

How would i do this?

Chun ping Wang
  • 3,879
  • 12
  • 42
  • 53

1 Answers1

0

You can use jquery to change your form action. Allowing your submit to be different based on your 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
 });
Malkus
  • 3,686
  • 2
  • 24
  • 39
  • hi thanks except i don't know the name of the input. These ids and actions are generated by 3rd party library framework. I only have the class $(".3rdPartySubmit").. so i want to go to each class add a event where once they click it would show a modal screen, than when they continue, it would continue through. – Chun ping Wang Feb 06 '13 at 18:57
  • @user578635 So are you looking to just have a variable be available so you know which action to run on your modal dialog? – Malkus Feb 06 '13 at 19:14
  • hi nope.. i want to be able to add a continue event .. click a debugger .. you know pause .. user enter some items, than hit continue. – Chun ping Wang Feb 06 '13 at 19:27