I am using
$('div:first', $('#' + id)).css({ 'color': 'red' })
to change the color of my div, but it does not work in my page.Then when I get the color by code
$('div:first', $('#' + id)).css('color')
,it is red! Who can tell me what happened?
I got the right answer about my problem, but it is deleted by someone. I paste it here and hope it can help others.
$('div:first', '[id="' + id + '"]').css({'color': 'red' });
And I will be very thankful if someone can tell me the difference between my code and the answer!
$('div:first', $('#' + id)).css( 'color', 'red', 'important' );