I have a jQ:
$(function() {
if($('span').css('color')=='rgb(250, 0, 0)' ||
$('span').css('color')=='#fa0000') {
$('span').before('hello ');
}
});
it work with this html:
<span style="color: #fa0000">Ann</span>
but it do not work with:
<span><span style="color: #fa0000">Ann</span></span>
When you are calling
.css('color'), it’s only getting the color of the 1st span. You want to check the color of each span. Try this:Demo: http://jsfiddle.net/y7nVZ/