title: Process a Form Submit with Multiple Submit Buttons in Javascript
body: <p>I have a form with multiple submit buttons, and I'd like to capture when any of them are pressed, and perform different JS code for each one.</p>
  
  <pre><code>&lt;form id="my-form"&gt;
      &lt;input type="email" name="email" placeholder="(Your email)" /&gt;
      &lt;button type="submit" value="button-one"&gt;Go - One&lt;/button&gt;
      &lt;button type="submit" value="button-two"&gt;Go - Two&lt;/button&gt;
      &lt;button type="submit" value="button-three"&gt;Go - Three&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Looking at an <a href="https://stackoverflow.com/a/5384732/1636799">older answer</a>, I can process <em>all</em> of the submit buttons in JS:</p>
  
  <pre><code>function processForm(e) {
      if (e.preventDefault) e.preventDefault();
  
      /* do what you want with the form */
  
      // You must return false to prevent the default form behavior
      return false;
  }
  
  var form = document.getElementById('my-form');
  if (form.attachEvent) {
      form.attachEvent("submit", processForm);
  } else {
      form.addEventListener("submit", processForm);
  }
  </code></pre>
  
  <p>But <strong>how can I discriminate amongst the different submit buttons?</strong>  Is there a way to get the <code>value</code> and perform logic from there?</p>
  
  <p>I don't need to have three <em>submit</em> buttons, per se... I just need three different buttons in a form to perform three different actions.</p>
  
  <p>Thanks!</p>