For loop for the all rows in the html table

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4930
    Pavan
    Member

    Can I use the for loop instead of for each for the all rows in the html table?

    Let’s suppose my table is:

    <table id="tblLoop">
      <tbody>
        <tr>...</tr>
        <tr>...</tr>
      </tbody>
    </table>
    #4934

    You can use the following code:

    var rows = $(“#tblLoop”)[0].find(‘tr’);
    if ($(rows).length != 0) {
    for (var j = 0; j < $(rows).length; j++) { // do somthing } }

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.