title: Getting the values of that specific row on Button Click
body: <p>Been doing this for hours now, and i still haven't found the solution,but the logic is there,grrr, Its just that Im stuck in getting the <code>id</code> of the button being clicked, I know this question been asked already, as i have implemented using <code>event.target.id</code> and <code>$('input[type="button"]').attr('id')</code>, but this does not work on my code,</p>
  
  <p>I have a table with <code>3 rows</code> <code>and 12 td's</code> , and the last td of each row is being hidden and Im checking the value of that hidden td if its 0 or 1, and then <code>appending</code> a new <code>td</code> saying its <code>pending for value 0</code> and <code>accepted for value 1</code> and I'm assigning <code>Id</code>'s dynamically as you can see from the script below.</p>
  
  <p><strong>Script</strong></p>
  
  <pre><code>var lastTr = $('table tbody').find('tr');
  $(lastTr).find('td:last').hide();
  var a = 0;
  $(lastTr).find('td:last').each(function(){
      var textVal = $(this).text();
      if(textVal == 0){
          $(this).after('&lt;td class="center"&gt;&lt;button id="'+a+'" type="button" class="btn-danger"&gt;Pending&lt;/button&gt;&lt;/td&gt;'); 
      }else if(textVal == 1){
          $(this).after('&lt;td class="center"&gt;&lt;button id="'+a+'" type="button" class="btn-success" disabled="disabled"&gt;Accepted&lt;/button&gt;&lt;/td&gt;'); 
      }
  
      });
  </code></pre>
  
  <p>After that, I wanted to get the <code>first, second, tenth and eleventh</code> text value of that certain row that has been click, and this is my code below,</p>
  
  <p><strong>Script</strong></p>
  
  <pre><code>//get specific value 1,2,10,11
      var value1, value2, value10, value11; //global variables which i will be needing later
      $('input[type="button"]').on('click', function(){
          var idButtonClicked = $(this).attr('id'); &lt;--- im stuck getting the ID of the button being clicked
          console.log(idButtonClicked);
          $(idButtonClicked).parent().parent().find('td').each(function(){
              value1 = $('td:eq(0)').text();
              value2 = $('td:eq(1)').text();
              value10 = $('td:eq(9)').text();
              value11 = $('td:eq(10)').text();
          });
          console.log('value 1 = '+ value1);
          console.log('value 2 = '+ value2);
          console.log('value 9 = '+ value10);
          console.log('value 10 = '+ value11);
  
      });
  </code></pre>
  
  <p>My <a href="http://jsfiddle.net/2K6TQ/6/" rel="nofollow">JSFIDDLE</a></p>