[ACCEPTED]-How to override inline css through javascript?-internet-explorer

Accepted answer
Score: 13

Of course you can by using jQuery's css() method 4 : http://docs.jquery.com/CSS/css#namevalue

So if for example you have the following 3 HTML:

<p style="color:red;">A colored text</p>

You can change the color by doing the 2 following in jQuery:

$("p").css("color","blue");

And it's going to work 1 in IE6.

Score: 4

!important does work in IE6, it's just your selector 7 span[style] won't, as attribute selectors aren't supported 6 there. If you can find another selector 5 that will pick the spans you want to override, that'll 4 work fine. Perhaps just .block span is enough?

Otherwise, yes, you 3 can change it from JavaScript if you absolutely 2 have to (don't you have any control over 1 the markup?):

span.style.fontWeight= 'normal';
span.style.color= 'black';

More Related questions