JSFiddle - React, Tailwind, and code Playground

by Ehsan Sajjad

HTML

<div style="background: #000">dd</div>
<div style="background-image: url(image.jpg);">dd</div>
<div style="background-position: url(image.jpg);">dd</div>
<div style="color: #000">dd</div>

CSS

.test {
    color:blue;
}

JavaScript

$("div").each(function () {
    console.log($(this).css("background-image"));
    if ($(this).css("background-image") != "none") $(this).addClass("test")
})