title: JQuery assign events to buttons
body: <p>I have 50 dynamically generated HTML buttons as follows:</p>
  
  <pre><code>&lt;input type="button" id="btn1" name="myButton" value="Click Me" /&gt;
  &lt;input type="button" id="btn2" name="myButton" value="Click Me" /&gt;
  :
  :
  :
  &lt;input type="button" id="btn50" name="myButton" value="Click Me" /&gt;
  </code></pre>
  
  <p>Which is the best way to assign click event to all buttons using jQuery? </p>
  
  <p>By using <code>id</code> or by using <code>name</code> attribute ?</p>