How to assign an inline style attribute to an element?

How to assign an inline style attribute to an element?

Assume the following code:

  1. <div class="foobar">.....</div>

with CSS:

  1. .foobar { background: blue !important; }

Now when I assign a new color with a jQuery statement like

  1. $(".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

  1. <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