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

  • Home
  • SEARCH
  • 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 8179019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:54:33+00:00 2026-06-06T23:54:33+00:00

I got something like this which contains about 1000 dom elements <table id=tableId> <tr

  • 0

I got something like this which contains about 1000 dom elements

  <table id="tableId">
    <tr class="selected"><td>Text 1</td></tr>
    <tr><td>Text 2</td></tr>
    ...
    <tr><td>Text 500</td></tr>
  </table>

problem is that i need to do something like this:

y = new selected tr;
$("#tableId").find("tr").removeClass("selected").eq(y).addClass("selected");

The problem here is the selector itself who takes about 600ms to process which is kinda too long for the things we are doing.

The machine im using uses a browser opera10 and has only 450Mhz running on linux!
Do you guys think that the problem comes from the machine being that slow?

Is there a way to improve the selector ?

  • 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-06-06T23:54:35+00:00Added an answer on June 6, 2026 at 11:54 pm

    I’ll tell you how to do it via programming logic:

    • store a reference to the “selected element”
    • unselect it
    • select the new one

    by storing the currently selected element, you don’t need to loop over tons and tons of tr elements to find the selected one.

    maybe an easier option for you would be to give the currently selected option an id of “currentlySelectedTr. id lookups are really optimized by web browsers.

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

Sidebar

Related Questions

I have got an XML document which looks something like this. <Root> <Info>....</Info> <Info>....</Info>
I've got a query that looks something like this: SELECT * FROM table WHERE
Say I've got something like this public void run(){ Thread behaviourThread = new Thread(abstractBehaviours[i]);
I've got something like this DateTime.Now.ToString(dd.MM.yy); In my code, And I need to add
When I run my rails console I got something like this: Loading development environment
I've got a process something like a workflow, assume it like this: Prepare Eat
I've got a MongoDB collection that looks something like this: [ { title: Entry
I've got a dict that looks something like this: d = {'Food': {'Fruit' :
I've got 3 tables that are something like this (simplified here ofc): users user_id
I've got a weird problem where if i do something like this in a

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.