title: jquery use of bind vs on click
body: <p>I have come across several methods for handling click events in jquery:</p>
  
  <p>bind:</p>
  
  <pre><code>$('#mydiv').bind('click', function() {
      ...
  });
  </code></pre>
  
  <p>click:</p>
  
  <pre><code>$('#mydiv').click(function() {
     ...
  }
  </code></pre>
  
  <p>on:</p>
  
  <pre><code>$('mydiv').on('click', function() {
     ...
  }
  </code></pre>
  
  <p>Two questions:</p>
  
  <ol>
  <li>Are they any other ways of doing this?</li>
  <li>Which one should I use, and why ?</li>
  </ol>
  
  <p>UPDATE:</p>
  
  <p>As eveyone has helpfully suggested, I should have read the docs better, and found out that I should use:</p>
  
  <p>on() or click(),</p>
  
  <p>which are effectively the same thing.</p>
  
  <p>However, nobody has explained why bind is no longer recommended ? I'll probably get more downvotes for missing the obvious somewhere, but I can't find a reason for this in the documents.</p>
  
  <p>UPDATE2:</p>
  
  <p>'on' has the useful effect of being able to add event handlers to dynamically created elements. e.g.</p>
  
  <pre><code>$('body').on('click',".myclass",function() {
      alert("Clicked On MyClass element");
  });
  </code></pre>
  
  <p>This code adds a click handler to elements with a class of 'myClass'. However, if more myClass elements are then dynamically added later, they automatically get the click handler as well, without having to explicitly call 'on'. From what I understand people are saying, this is also more efficient (see Simons answer below).</p>