title: jquery detect which button submitted form
body: <p>I have a form with the following:</p>
  
  <pre><code>&lt;form id="my-form" ...&gt;
      ...
      &lt;button type="submit" name="bttnsubmit" value="1"&gt;The first button&lt;/button&gt;
      &lt;button type="submit" name="bttnsubmit" value="2"&gt;The last button&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I'd like to detect which triggered the form submit event using just:</p>
  
  <pre><code>$('#my-form').submit(function(){
      //psuedo code
      if($('[name=bttnsubmit]').val() == 1) {
          ....
      }
  });
  </code></pre>
  
  <p>Obviously that selector will always return the value of the first bttnsubmit element it comes across, so I need some other magic selector or filter or something.</p>
  
  <p>I have seen <code>$('[name=bttnsubmit][clicked=true]')</code> touted about but that has not yet worked in my attempts...</p>
  
  <p>I could of course resort to <code>$('[name=bttnsubmit]').click()</code> but would prefer to be able to achieve my goals in the forms submit event.</p>
  
  <p>Any help/tips much appreciated.</p>