JSFiddle - React, Tailwind, and code Playground
by jasonwilczak
HTML
<div id="parent">
<span style="color: white;background-color: #345678;">1</span>
<span style="background-color: green;">2</span>
<span>3</span>
<span style="color: yellow;background-color: #345678;">4</span>
<span style="width: 2px;background-color: #345668;">5</span>
</div>
<div id="result"></div>
JavaScript
//Locating the spans
var locatedSpans = $("span[style*='background-color: #345678']");
$('#result').html('Spans that match: ' + locatedSpans.length);
//Adding the class to all spans found
$(locatedSpans).addClass('added');
$('#result').html($('#result').html() + '</br>' + 'Spans with new class: ' +$('.added').length);