title: How to catch a form submit action in JavaScript/jQuery?
body: <p>I have a form that the user can submit using the two following buttons:</p>
  
  <pre><code>&lt;input type="submit" name="delete" value="delete" id="deletebutton" class="pure-button"&gt;
  &lt;input type='submit' id="submitbutton" name="btnSubmit" value="save" class="pure-button pure-button-primary"&gt;
  </code></pre>
  
  <p>I have an <code>submit</code> event listener that loads a certain function I need to process the form (the form has id <code>#submitform</code>):</p>
  
  <pre><code>document.querySelector('#submitform').addEventListener('submit', function(e) {
      e.preventDefault();
      // Some code goes here
  });
  </code></pre>
  
  <p>However, this code only reacts when <code>#submitbutton</code> is clicked. When <code>#deletebutton</code> is clicked the form submits as usual. </p>
  
  <p>How do I avoid that and have <em>another</em> function listening to whether <code>#deletebutton</code> is clicked?</p>
  
  <p>Thank you!</p>