How do I unset an element's CSS attribute using jQuery? -


If I use a CSS value on a particular element:

  $ ( '# Element '). CSS ('background-color', '# ccc');  

I want to be able to unset that element-specific value and use the cascaded value:

  $ ('# element' ). CSS ('background color', empty);  

But this syntax does not seem to work - is it possible to use another syntax?

Thanks in advance!

Edit: The value is not inherited from the original element - the original value comes from the element-level selector. Sorry for any confusion!

From

to:

Setting the value to an empty string Style property - eg $ ('# mydiv'). CSS ('color', '') - Removes the property from an element if it has already been applied directly, even in the HTML style attribute, jQuery . CSS () method, or style however, through a direct dom manipulation of a property, a stylesheet or & lt; Style & gt; Remove a style applied with a CSS rule in the element.


Comments