Submit data of form with dynamic id

I am trying to submit the data for this form, which has 3 different buttons:

<form action="/game.php?village=8404&amp;screen=market&amp;mode=own_offer&amp;action=modify_offers&amp;h=85fd1491" method="post">
  <input class="btn btn-cancel" type="submit" value="Delete" name="delete">
  <input type="text" size="2" name="mod_count" value="1" onkeydown="return no_enter(event)">
  <input class="btn" type="submit" value="Increase" name="increase">
  <input class="btn" type="submit" value="Reduce" name="decrease">
</form>

I would like to either submit the data in the same manner of "increase" or click that submit button. Ideally, I wouldn't have to replicate the URL which appears after the form action= as this varies from page to page.

When the form has a definite id, I've been using:

$('#thisFormId input[type=submit]').click();

But can't work out.

So how I can do that in this instance?

Answers 1

  • If I understand the questions:

    $("input[name=increase]").click();

    will trigger the click event of the Increase button and submit the form, which is what you want?


Related Articles