loop html table using jquery and for loop (not for each)

Posted by Mandeep Singh on Stack Overflow See other posts from Stack Overflow or by Mandeep Singh
Published on 2013-06-30T10:13:57Z Indexed on 2013/06/30 10:21 UTC
Read the original article Hit count: 193

Filed under:
|
|

I have a HTML table

 <table id="mytab">
  <thead>
    <th>col1</th>
    <th>col2</th>
  </thead>
  <tbody>
  <tr>
    <td>1</td>
    <td>2</td>
  </tr>
  <tr>
     <td>11</td>
     <td>22</td>
  </tbody>
 </table>

and i am writing the jquery function

  function LoopTable()
  {
      $row = $('#mytab tbody >tr"); //here I have successfully find all the rows.

     //now i want to loop on rows and find each column row
     for (var i=0; i<$rows.length; i++)
     {
         //need something here to find col data

     }

what I should use to have column values from row

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery