title: How to select Just 1 Row from a Table using Jquery
body: <p>I have a created table where i display multiple records..I want to add update functionality using Ajax.. </p>
  
  <p>I have written the following code, When i click on any row it make all rows editable..I only want to edit the specific row in which i clicked.</p>
  
  <p>Kindly guide me how to achieve this.</p>
  
  <pre><code>&lt;button type="button" 
  class="updateUser btn btn-primary btn-xs" data-userId="&lt;?php echo $id; ?&gt;"&gt;
  &lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;
  &lt;/button&gt;
  
  
      $(document).on("click", ".updateUser", function(){
           $('tr td:nth-child(2)').each(function () {
                  var html = $(this).html();
                  var input = $('&lt;input type="text" /&gt;');
                  input.val(html);
                  $(this).html(input);
              });
  
          });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/eB0Tb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eB0Tb.png" alt="enter image description here"></a></p>
  
  <p><strong>EDIT - HTML CODE</strong></p>
  
  <pre><code>&lt;table class="table table-hover"&gt;                                       
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;#&lt;/th&gt;
              &lt;th&gt;Username&lt;/th&gt;
              &lt;th&gt;Password&lt;/th&gt;
              &lt;th&gt;Role&lt;/th&gt;
              &lt;th&gt;Edit&lt;/th&gt;
              &lt;th&gt;Delete&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;"PHP Dynamic ID "&lt;/td&gt;
              &lt;td&gt;"PHP Dynamic Username "&lt;/td&gt;
              &lt;td&gt;"PHP Dynamic Password "&lt;/td&gt;
              &lt;td&gt;"PHP Dynamic Role "&lt;/td&gt;
  
              &lt;td&gt;                                                        
                  &lt;button type="button" class="updateUser btn btn-primary btn-xs" data-userId="&lt;?php echo $id; ?&gt;"&gt;
                      &lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;
                  &lt;/button&gt;
              &lt;/td&gt;
              &lt;td&gt;
                  &lt;button class="deleteUser btn btn-danger btn-xs" type="button" data-userId="&lt;?php echo $id; ?&gt;"&gt;
                      &lt;span class="glyphicon glyphicon-remove"&gt;&lt;/span&gt;                                    
                  &lt;/button&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;                                        
  &lt;/table&gt;
  </code></pre>