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

The Archive Base Latest Questions

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

I am a jquery newbie and have been adding alert timestamps into my html

  • 0

I am a jquery newbie and have been adding alert timestamps into my html file to find what lines of code are making things slow. I have found the main bottleneck and am looking for help to know how to change these 2 lines to be faster.

My html file has about 600 list items in it. If the file only had 6 list items, the speed would be fine.

    var visablecount = 0;
    var totalcount = 0;
    for (var key in checkArray) {
        if (checkArray.hasOwnProperty(key)) {
            $tmp = key.split(" ");
            $.each($tmp, function(i, val4) {            
                //*********next two lines are the most slow lines*********
                visablecount = $itemsToFilter.children("li."+val4+":visible").length;
                totalcount = $itemsToFilter.children("li."+val4+":hidden").length + visablecount;
                //********************************************************
                $("#labelID"+val4).text(val4 +" (" + visablecount + "/" + totalcount + ")");
                if ($this.is(":checked")) {
                    if ($('.' + val4 + '').is(":visible") == true) {                            
                        $('.filters input[value=' + val4 + ']').attr('checked', true);                          
                    }
                }
            });
        }
    }
  • 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-28T06:40:33+00:00Added an answer on May 28, 2026 at 6:40 am

    DOM updates are the slowest, so if you can store them and insert in one go, at the end, it would be much faster.

    Your $("#labelID"+val4).text(...) is probably the slowest part of the code. Build this up as a string and insert it once, out of the loop.

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

Sidebar

Related Questions

I am jQuery newbie and I have been trying to set up a file
I'm a jQuery newbie. I have a simple form with n lines (although I'm
I'm a jQuery newbie, and I have trouble with a little script I created.
I'm a jQuery newbie as of this morning, and this is the code I've
I am newbie to jQuery, can someone explain what this code does: $(#currency form).submit(function(e)
I'm a jQuery newbie, so be gentle! I have a loop that outputs extra
I'm a jquery/rails newbie and I'm having trouble using .sortable(). I have expandable rows
I am a newbie developing using rails and jquery and having been searching everywhere
am newbie to jquery..I have a three steps registration form in which the user
Forewarning: I'm a newbie to JQuery. I have a collection of links and lists

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.