title: Jquery - Get Button Value Dynamically
body: <p>I have a JS that output the button dynamically: </p>
  
  <pre><code>&lt;button class='btn btn-mini btn-primary likebtn' name='likebtn' value='1' type='button'&gt;value1text&lt;/button&gt;
  
  &lt;button class='btn btn-mini btn-primary likebtn' name='likebtn' value='2' type='button'&gt;value2text&lt;/button&gt;
  
  
  $('button=[name=likebtn]').click(function (){
      alert($(this).val());
  });
  </code></pre>
  
  <p>I would like to get the value of the button click! But it doesn't seem to get the name of button clicked. Why? Find it strange...</p>
  
  <p>Code is here...</p>
  
  <pre><code>$('#div').append("&lt;button class='btn btn-mini btn-primary likebtn' name='likebtn' type='button' value='"+obj.value+"'&gt;"+"LIKE"+"&lt;/button&gt;");
  </code></pre>