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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:22:44+00:00 2026-05-11T08:22:44+00:00

Can any one help me please, I have two sections of my question. What

  • 0

Can any one help me please, I have two sections of my question.

  1. What I want to do is changing css class rules using jQuery on the fly.

    .classname{color:red; font-size:14px;}

    In example above I have a class named .classname now using jQuery I want to change the font size only not color with in .classname not by adding css inline.

  2. I want to create and save .classname change to a file remember there will be complete stylesheet or no of classnames that will be save in file.

How I can do this the easiest and better way?

Thanks!

  • 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. 2026-05-11T08:22:45+00:00Added an answer on May 11, 2026 at 8:22 am

    As far as I know there’s no jQuery way to do this. There might be some jQuery plugin for this but I don’t know.

    Basically, what you’re trying to achieve in your first question is possible using the styleSheets property of the document object. It’s a little bit more complicated than that as you need to walk to a rather deep object chain, but nevertheless works in all major browsers including Internet Explorer 6. Below is a proof of concept. The CSS is inside a STYLE tag, but works with external CSS just as well. I’ll let you do the abstractions.

    Proof of Concept

    <!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> 

    For your second question, I don’t have time to write a solution but it would involve reading the CSS declarations just as above and use the cssText property of a CssRule object in order to build a string which will eventually be sent to the server using a Ajax POST request. The server side is your business.

    References:

    • document.styleSheets (Mozilla)
    • styleSheet object (Mozilla)
    • CssRule object (Mozilla)
    • document.styleSheets (MSDN)
    • CssRule object (MSDN)

    Hope it helps

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

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You cannot reliably do this - after all, it could… May 11, 2026 at 1:55 pm
  • added an answer I'd suggest wrapping the CRITICAL_SECTION with a class that will… May 11, 2026 at 1:55 pm
  • added an answer You probably want flush(). However, PHP may be using output… May 11, 2026 at 1:55 pm

Related Questions

Can anyone help me with the trying to write SQL (MS SqlServer) - I
I just forgot the password. Can anyone help me how to get back the
Wondering if anyone can help me with this annoying but trivial (in terms of
I was wondering if anyone can help me get started with creating a room
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Concerning headers in a library, I see two options, and I'm not sure if
My program that I am writing's purpose arose with this issue: There are two
Greetings everyone. This is my first question here at stackoverflow so please bear with
I have two mailboxes in my Outlook. One that is mine and it automatically

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.