underscore
underscore

Reputation: 67

apply CSS style for Pseudo elements from jQuery

I am running a wordpress installation in an iframe and depending on a cookie set by the main site I am adjusting the theme color in the header.php by

$("html *").css( {"background-color":"black", "color":"white"} );

which works perfect except for a single unidentified element that stays white. It may be seen bottom left at http://wjst.de/l/6wz after clicking background. I wonder how an element can escape the formatting?

Upvotes: 0

Views: 194

Answers (2)

Soundar
Soundar

Reputation: 2589

You can't apply the css style for the pseudo element directly from script. If you want to apply from script side, then u need to form a style element with your required style attributes and need to append that style tag in the headed tag. then only the styles are applied to the pseudo elements aslo.

Please refer this Fiddle.. this might helps you....

Upvotes: 0

beautifulcoder
beautifulcoder

Reputation: 11340

I recommend you go through your computed styles and see how it overrides this. jQuery's css sets the inline style which has the highest priority.

Upvotes: 1

Related Questions