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 7089605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:56:32+00:00 2026-05-28T07:56:32+00:00

hi i want to loop through some tr’s like this . <tr> <td> <input

  • 0

hi i want to loop through some tr’s like this .

<tr>
 <td> <input type="radio" id="r11"   value="a" name="r1_selectedobjects" /> </td>
   <td><input type="radio" id="r12"   value="b" name="r1_selectedobjects" /> <td>
</tr>
<tr>
   <td><input type="radio" id="r21"   value="a" name="r2_selectedobjects" /></td>
  <input type="radio" id="r22"   value="b" name="r2_selectedobjects" /></td>
</tr>
   <td><input type="radio" id="r31"   value="a" name="r3_selectedobjects" /></td>
   <td><input type="radio" id="r32"   value="b" name="r3_selectedobjects" /></td>
<tr>
<tr>
<td><input type="submit" id="matbutton" data-inline="true"  value="Submit" onclick="return CheckMatrixRadio(this);" /></td>
    </tr>

i can do this by $('tr').each(function(){});

i want to skip the 3 rd tr

this one

</tr>
   <td><input type="radio" id="r31"   value="a" name="r3_selectedobjects" /></td>
   <td><input type="radio" id="r32"   value="b" name="r3_selectedobjects" /></td>
<tr>

how to do this . think that i don’t know any calss or id names , only thing i know is index of my tr , in this case , 3

how to skip that tr in my each loop . please help………..

  • 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-28T07:56:33+00:00Added an answer on May 28, 2026 at 7:56 am

    The each callback receives a zero-based index telling you which matched item you’re looking at, so:

    $('tr').each(function(index){
        // If not the third one...
        if (index !== 2) {
            // ...do something
        }
    });
    

    If for any reason you don’t want to use each (you mentioned it in your question, but just covering bases) but instead want to create a jQuery instance with all the rows except the third one, the most efficient way I know is:

    var rows = $('tr');
    rows = rows.not(rows[2]);
    

    …which removes the third row from the matched set via not. You could also achieve the same thing with a selector involving :not and :eq:

    $('tr:not(:eq(2))')
    

    …but then you’re requiring jQuery to process the selector rather than allowing it to pass the selector off to the browser’s querySelectorAll implementation (if it has one). *

    Examples of all three


    (Side note: If there are unrelated trs anywhere on the page, you may need to make your selector more specific to the group of rows you’re looking at.)


    * PiTheNumber points out in his answer that $('tr:not(:nth-child(3))') should do it, too. And that’s useful because it has the advantage that both :not and :nth-child can be processed by the browser natively. Note that :nth-child uses 1-based indexes, and is very different from :eq — it checks which child an element is of its container, not whether it’s the nth matched element. Should work for a table with tr elements provided they’re all in the same tbody, though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In C, I want to loop through an array in this order for(int z
I have an application I'm working on where I want to loop through some
I'm using $().each() to loop through some items. I want to make sure that
i want to loop through all dropdown selects with a certain class name and
I want to loop through the controls on a UserControl and set a property
I want to loop through a database of documents and calculate a pairwise comparison
Introduction: I want to loop through XML files with flexible categories structure. Problem: I
I have a listbox and I want to loop through each of the items
Suppose I have a vector<int> myvec and I want to loop through all of
I have the below but want to only loop through lines in #lines which

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.