title: using jquery to check if a button was clicked or not
body: <p>I am trying to check if a button was clicked or not using jquery.</p>
  
  <p>this is my snippet in the javascript section of my code</p>
  
  <pre><code>window.onbeforeunload = function() {
  
  jQuery(':button').click(function () {
      if (this.id == 'click') {
          alert('this button was clicked');
      }
      else if (this.id == 'button2') {
          alert('Button 2 was clicked');
      }
  });
  
  };
  </code></pre>
  
  <p>this is the button I am using to test the function</p>
  
  <pre><code>&lt;button id="click"&gt;save&lt;/button&gt;
  </code></pre>
  
  <p>on clicking the button nothing happens. please kindly assist</p>