I would like to select every div that has a red background color for example. is this possible in jquery?
<div style="background-color:red"></div>
<div style="background-color:white"></div>
<div style="background-color:red"></div>
<div style="background-color:yellow"></div>
thank you
This code also works for CSS that is not defined in the style attribute of the tag:
$('div').filter(function() {
return $(this).css('background-color') == 'red';
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With