Meelan Lohani
Meelan Lohani

Reputation: 1

override inline style for all childs inside a div

<div style="color:#FFFFFF !important;">

<!-- A Dynamic content comes from from third party. -->
<p style="color:red;"> This should be white instead of red. </p>
<p>Test is test. This should also be white.    </p>
<span> Check is check. This should also be white.    </span>
<!-- Dynamic Content ends -->
</div>

HOW do I make all the texts to be white inside the div given above. Is it possible by using any jquery or other similar language??

Upvotes: 0

Views: 718

Answers (2)

Meelan Lohani
Meelan Lohani

Reputation: 1

Finally Found answer.

$(div p).css('color':'white');
$(div span).css('color':'white');

This was what I exactly wanted. It overrided the inline css of all the p tag as well.

Upvotes: 0

Drixson Ose&#241;a
Drixson Ose&#241;a

Reputation: 3641

Using Jquery children() and css() function to override the style , check my FIDDLE for the demo

Upvotes: 1

Related Questions