title: What is the difference between on("click",function()) and onclick="function();"?
body: <p>So if I want something to happen when I click a button I can either do:</p>
  
  <pre><code>&lt;!-- EXAMPLE A--&gt;
  &lt;input type="button" onclick="alert('hello world');"&gt;
  </code></pre>
  
  <p>or I can do</p>
  
  <pre><code>&lt;!-- EXAMPLE B--&gt;
  &lt;input type="button" id="clickme"&gt;
  &lt;script&gt;
     $('#clickme').on("click",function(){alert('hello world');});
  &lt;/script&gt;
  </code></pre>
  
  <p>Or of course any variations (on <code>change</code>, on <code>hover</code>) and shortcuts (<code>.click()</code> <code>.change()</code>) are possible...</p>
  
  <p>Besides the fact that A is shorter, <strong>what are the differences? Which is better and why?</strong></p>
  
  <p>I noticed, that when I use <code>.html()</code> to dynamically add an element to the site (like a button) B doesn't work for this newly created button, and I need to use A...</p>
  
  <p>Any insights would be helpful!</p>