title: Execute jQuery function after clicking <button>
body: <p>I am struggling with the following piece:</p>
  
  <pre><code>&lt;script&gt;
  $('button').click(function(){
  alert("button clicked");
  });
  &lt;/script&gt;
  
  &lt;button type="button" class="button-save"&gt;Save&lt;/button&gt;
  </code></pre>
  
  <p>I do not get an alert when I click the button. I tried targeting the class with the button, but that didn't help either.
  I am trying to execute some ajax (not in my example of course) when I click the Save button like in <a href="https://stackoverflow.com/a/18539164/2976720">this</a> answer, so I need to find when the user clicked the button.</p>
  
  <p>Can anyone help? </p>