JSFiddle - React, Tailwind, and code Playground
HTML
<div bgcolor="red">Item 1 (red)</div>
<div style="background-color: blue">Item 2 (blue)</div>
JavaScript
var item1 = $('div[bgcolor="red"]').text();
var item2 = $('div').filter(function() {
return $(this).css('background-color') == 'rgb(0, 0, 255)';
}).text();
console.log(item1+", "+item2)