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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:14:41+00:00 2026-06-01T19:14:41+00:00

EDIT: The question morphed into how to optimize a massive CSS change to 700

  • 0

EDIT: The question morphed into how to optimize a massive CSS change to 700 or more divs. I’m leaving the old question below to describe my original approach.

I have the following jQuery but it is not behaving as I expect. There are around 700 divs with class gr so hiding them takes a noticeable time. I am trying to do:

  1. When “Show/hide Pronunciation” is clicked, immediately change that text to “Working”
  2. Wait until all ‘div.gr’ are hidden/shown
  3. “Working” goes back to “Show/hide Pronunciation”

    $(document).ready(function () {
     $('#togglePron').click(function() {
       $('#togglePron').html("Working...");
       $('div.gr').toggle();
       $('#togglePron').html("Show/hide Pronunciation");
      });
    });
    ...
    ... 
    <div class="pronlink" id="togglePron">Show/hide P</div>
    
    <div class="gr">hai</div><div class="zi">A</div>
    <div class="gr">nao</div><div class="zi">B</div>  
    etc.
    

Thanks to Mike Lentini there’s a jsfiddle for this question.

This is the full page I’m working on

The behavior I observe is that “Show/hide P” takes a noticeable time to change, then it changes briefly to “Working”, and it goes back to “Show/hide”. So is jQuery bunching together both the html() and .toggle(), instead of running html() first?

This seems to be browser specific because in Opera it does what I want. In IE 7 and Chrome 18, the behavior is as I described. Is there a way to make the behavior I want in Chrome happen? Or a better way to do what I am describing?

  • 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-01T19:14:43+00:00Added an answer on June 1, 2026 at 7:14 pm

    One way would be to dynamically modify your css styles directly (not per element) using javascript.

    In your page, all of the text divs in each <td> have a class='gr' in them WITH an inline style="display:block;". First I’d move the display:block; into the style sheet (preferably into the first position).

    Using this SO answer (and this page, also this SO answer), I’d go through each of the stylesheets until you got the one your interested in (adding a title to the <css /> will allow you to easily do this). Remove the display block (which is a simple stylesheet.deleteRule(<index>) index will be zero because you put it first in .css). Add a new display:none;.

    This will essentially change the whole css for the page vs changing them individually PER element as you’re forced to do with JQuery.

    Maybe not the most popular solution but still allows you to keep your current design (not duplicating the information) and uses css for what its suppose to do (tho ‘dynamic’).


    Follow up:
    Nice find with the “Totally Pwn CSS with Javascript” . Does exactly what I would do in your situation (wanted to add it here for posterity 🙂 )

    On a side note, someone should make a feature request to JQuery to be able to do something like this with ease. 🙂


    Follow Up 2: just realized someone else posted solution this before me

    Another way you can do this is to remove the ‘gr’ class and add another ‘grHide’ class.
    Check out this fiddle to see what I mean.

    Do as I said above, move the inline display:block; into the css stylesheet under the .gr class. Add a separate class that does everything .gr does but do a display:none; instead.

    This should allow you to use jquery AND still have it be very quick. The fiddle is quick anyways.

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

Sidebar

Related Questions

EDIT: This question is more about language engineering than C++ itself. I used C++
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT : This question duplicates How to access the current Subversion build number? (Thanks
(EDIT: This question is now outdated for my particular issue, as Google Code supports
Edit This question has gone through a few iterations by now, so feel free
EDIT: This question is a duplicate of What is the difference between managed and
EDIT: This question was initially too general, I think. So What I really need
-Edit- Alternative question/example How do i cast A to object to class A when
EDIT: This question is about finding definitive reference to MySQL syntax on SELECT modifying

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.