JSFiddle - React, Tailwind, and code Playground

HTML

<div id="foo-bar">asd</div>

JavaScript

if ($("div[id$='bar']")) {
alert("foo bar");
}