Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6215033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:58:55+00:00 2026-05-24T06:58:55+00:00

With jQuery is simple to loop through cells or rows, but it is not

  • 0

With jQuery is simple to loop through cells or rows, but it is not simple to loop through the cells of a columns.

//for cells of rows I will do this
$('table tr').each(function(index,elem)...//loop through cell of row [index]

Any one suggest a simple method for looping through cells of a columns?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T06:58:57+00:00Added an answer on May 24, 2026 at 6:58 am

    Edit: I misread the original question. This example will loop through all the cells in a table, ordered by their cells first.

    Markup:

    <table class='sortable'>
        <tr>
            <td>a</td>
            <td>d</td>
            <td>g</td>
        </tr>
        <tr>
            <td>b</td>
            <td>e</td>
            <td>h</td>
        </tr>
        <tr>
            <td>c</td>
            <td>f</td>
            <td>i</td>
        </tr>
    </table>
    

    jQuery:

    var cells = $('table.sortable td').sort(function(a, b) {
        //compare the cell index
        var c0 = $(a).index();
        var c1 = $(b).index();
        if (c0 == c1)
        {
            //compare the row index if needed
            var r0 = $(a).parent().index();
            var r1 = $(b).parent().index();
            return r0 - r1;
        }
        else
            return c0 - c1;
    });
    
    //console.log(cells);
    cells.each(function() {
       console.log($(this).html());
    });
    

    Result:

    a
    b
    c
    d
    e
    f
    g
    h
    i
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a really simple jQuery question, but I couldn't answer it after
I have a simple jquery loop that goes through my form and sees if
I've seen many JQuery examples that make use of $.each to loop through a
I'm using the simple jQuery DIV refresh code. var refreshId = setInterval(function() { $('#refreshdash').load('dashboard.php?cache=');
I have simple AJAX function that uses jQuery to return an array of 300
the latest version of jQuery Marquee Simple , uses jQuery 1.4.2. but the newer
I'm using Jquery to submit a form. I want to loop through the form
Given the simple JSON below, how can I use jQuery to append each result
I have what i thought was a simple javascript / jquery function (fade out
Just a simple jquery tooltip when you rollover a div.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.