2

How to traverse table in JQuery?

Code is as follows,

<table id="tblData">
  <tr id="tr_1">
     <td><input type="text" id="txtData1" /></td>
  </tr>
  <tr id="tr_4">
     <td><input type="text" id="txtData4" /></td>
  </tr>
  <tr id="tr_10">
     <td><input type="text" id="txtData10" /></td>
  </tr>

</table>

How to get html of each row?

Pradip
  • 1,317
  • 4
  • 21
  • 36

1 Answers1

7
$('#tblData tr').each(function() {
    alert($(this).find('input').val()); // `this` is TR DOM element
});
Alex Gyoshev
  • 11,929
  • 4
  • 44
  • 74