How to assign an inline style attribute to an element?
Assume the following code:
- <div class="foobar">.....</div>
with CSS:
- .foobar { background: blue !important; }
Now when I assign a new color with a jQuery statement like
- $(".foobar").css({'background-color' : 'red'});
then the previous color is NOT overwritten since it has an "!important" flag.
In order to overwrite it anyway I have to assign the new value as inline style just as if would have written
- <div class="foobar" style="background:red">.....</div>
This coding has higher priority as "!important".
BUT:
How do I assign such an inline style with jQuery and not as a value on "normal" CSS level?
Thank you