You can modify the CSS rules directly, see this plugin:
http://flesler.blogspot.com/2007/11/jqueryrule.html

I wrote this a while back, not thorougly tested. I guess adding a new
class rule to the end of the stylesheet will override previous rules
(this only adds to the first stylesheet in the document)

// addStyles 0.1
// ricardo tomasi < ricardobeat at gmail com >
// Licensed under the WTFPL - http://sam.zoy.org/wtfpl/
function addStyles(rule){
     var sheet = document.styleSheets[0],
          ln = (sheet.cssRules||sheet.rules).length;
     if (sheet.addRule) {
         rule = rule.match(/(.*){(.*)}/);
         sheet.addRule(rule[1],rule[2], ln);
     } else {
         sheet.insertRule(rule, ln);
     };
     return arguments.callee;
};

On Mar 29, 11:23 am, Lars Schöning <tahp...@gmail.com> wrote:
> Hello,
>
> Apologies if this turns out to be a trivial question. I currently am
> working with jQuery on a set of elements assigned to colored
> categories via a 'cat_[id]' class. Categories can change colors and if
> they do I want to update the color of every elements belonging to it.
> I want the same to be true in all new events added.
>
> I would believe that the easiest solution to this problem would be
> changing the 'color' attribute directly in the CSS class 'cat_[id]',
> but have found no way to do so. As I am fairly new to jQuery I might
> also be overseeing a much more elegant solution. Can anyone clarify?
>
> Thanks in advance,
> Lars

Reply via email to