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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:28:40+00:00 2026-06-13T04:28:40+00:00

How can I change the css using jQuery such that it takes effect for

  • 0

How can I change the css using jQuery such that it takes effect for future elements as well? I have an issue where I’m using $().show() to toggle the display on some elements, but then I append new elements with the same class, and they remain hidden.

<style type="text/css">
  .visibleState { display: none; }
</style>
<script>
  $('.visibleState').show();
  $('#appendHere').html('<div id="second" class="visibleState">* Second is NOT? visible</div>');
</script>

This has probably been asked, but I can’t find it. I tried using live() in different ways, but that didn’t seem to work. What’s the right way to do this?

Example: http://jsfiddle.net/amorris/wykhv/

  • 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-13T04:28:41+00:00Added an answer on June 13, 2026 at 4:28 am

    Look at this:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    
    <html>
    <head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta http-equiv="imagetoolbar" content="false">
    <meta http-equiv="imagetoolbar" content="no">
    <style type="text/css">
    .classname {
     color: red;
     font-size: 14px;
    }
    </style>
    <script type="text/javascript">
    window.onload = function() {
        document.getElementById("button").onclick = function() {
            var ss = document.styleSheets;
    
            for (var i=0; i<ss.length; i++) {
                var rules = ss[i].cssRules || ss[i].rules;
    
                for (var j=0; j<rules.length; j++) {
                    if (rules[j].selectorText === ".classname") {
                        rules[j].style.color = "green";
                    }
                }
            }
        };
    }
    </script>
    </head>
    <body>
    
    <h1 class="classname">Some red text</h1>
    
    <button id="button">Make text green</button>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I change CSS display none or block property using jQuery?
How can I change CSS from javascript . I'm using jQuery-ui Dialog and I
I know that with CSS, hovering over one elements can't change the properties of
Can't seem to get jQuery to change my css. In my css file this
I have several large CSS files and making a change can sometimes take a
I understand that I can change a sql table using the follow sp: EXEC
I'm trying to change the css of the following label using JQuery but I
I, for some reason, can't change the zIndex of an element using jQuery. I've
How can I using jQuery make the image inside of a div change to
Weird little snafu. I'm using jQuery's .css() method to change the size of text

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.