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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:34:54+00:00 2026-05-29T04:34:54+00:00

When I am using jquery each and calling not inside each is giving performance

  • 0

When I am using jquery each and calling not inside each is giving performance impact on IE Browser with error, ‘Stop running the script’.

Using, $("li:not(.sel)", this).hide(); statement getting the performance issue.

Tried with $("li", this).not(".sel").hide(); also $("li[class != sel]", this).hide();

When I use $("li[class != sel]", this).hide();, In IE8 handled performance and not getting the stop script message.

In FF all the three are working perfectly.

In IE7 getting the ‘Stop running the script’ message for all the three.

Please help me out on this.

Thanks in advance.

Edit:
These li’s are the list of filter options like in eBay.
By default I show only 5 li’s at first. When I click on the link called ‘choose more’ under the filters. I open a modal window and select the list of options in checkboxes and on submit I will append the ‘sel’ class to the selected li’s. Finally in the logic the li’s with no ‘sel’ are hidden. These li’s can be more than 400 or less. Depends on the data. User has the right to select all the li’s.

Thanks for the response. Please give me some ideas 🙂

  • 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-29T04:34:55+00:00Added an answer on May 29, 2026 at 4:34 am

    Well, it’s obviously a performance problem. My guess it’s because jQuery first collects a list of all items before looping over them.

    I don’t think there is a way in jQuery to avoid that, so I would suggest not to use jQuery but regular DOM methods instead to loop over the items:

    var item = this.firstChild; // Assuming "this" is the parent of the list items
    while (item) {
      $(item).filter(":not(.sel)").hide();
      item = item.nextSibling;
    }
    

    I’m using jQuery inside the loop again, which is simpler, but also slower. You may need to fallback to DOM methods there, too:

    if (item.tagName == "LI" && item.className != "sel") {
      item.style.display = "none";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jquery tabify with 4 tabs and each content same form calling via
I am using jQuery to add placeholders to each text box on a page.
I am using jQuery to parse an RSS feed. Within each <item> is a
$.each(3,function(i){ alert(i) }) alert 0,1,2 how to do this using jquery? thanks
I'm generating an unordered list through javascript (using jQuery). Each listitem must receive its
I'm having issues with some jQuery code I have. Using $.each I am looping
I want to deserialize the JSON string below, using jQuery each function, but the
I am using .each() to iterate over the links in the jQuery object $firstParagraph
I am using jquery each tag to render json data from the server as
Using jQuery , how can I dynamically set the size attribute of a select

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.