JSFiddle - React, Tailwind, and code Playground
by suryagahlot
HTML
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<div class="example">
<p>P element in first div with class="example". Div's index is 0.</p>
</div>
<div class="example">
<p>P element in second div with class="example color". Div's index is 1.</p>
<p class="example-this">Colors mean nothing if you're color blind</p>
</div>
<p><strong>Note:</strong> The getElementsByClassName() method is not supported in Internet Explorer 8 and earlier versions.</p>
<script>
function hexToRgb(hex) {
var bigint = parseInt(hex, 16);
var r = (bigint >> 16) & 255;
var g = (bigint >> 8) & 255;
var b = bigint & 255;
return "rgb(" + r + ", " + g + ", " + b + ")";
}
$('*').filter(function () {
return ($(this).css('background-color') == hexToRgb('a3a3a3'));
}).css('background', 'green');
</script>
CSS
.example-this {
background: #a3a3a3;
}
div {
border: 1px solid black;
margin: 5px;
}