Javascript provides a collection of document.stylesheets that provides a list of CSSStyleSheet objects. You can go through this collection to find any specific css rule that interests you and change its rules.
However, as mentioned above, this is probably not the right approach to what you are trying to achieve. It may be a bit of a browser and just feels hacked.
You will be better off having 2 separate rules.
.red { color :red } .blue { color : blue }
Inside your javascript, a variable is supported that contains the current default class for your elements, i.e. current_class = 'blue'. When you create an element simply .addClass (current_class). If you want to change all elements, .toggleClass (current_class, new_class).
source share