Can any one help me please, I have two sections of my question.
-
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
.classnamenow using jQuery I want to change the font size only not color with in.classnamenot by adding css inline. -
I want to create and save
.classnamechange 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!
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
styleSheetsproperty of thedocumentobject. 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
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
cssTextproperty 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:
Hope it helps