JSFiddle - React, Tailwind, and code Playground
by 2Yootz
HTML
<a class="filthy dog">Test1</a>
<br />
<a class="filthy pig">Test2</a>
<br />
<a class="cat">Test3</a>
<br />
<br />
<div id="output"></div>
CSS
#output {
font-weight:bold;
color:green;
}
JavaScript
//OR SCENARIO
$("a").each(function () {
if ($(this).is(".filthy, .cat")) {
//$("#output").append($(this).html() + "<br />");
}
});
//OR SCENARIO (BETTER)
$("a.filthy,a.cat").each(function () {
//$("#output").append($(this).html() + "<br />");
});
//AND SCENARIO
$("a.pig.filthy").each(function () {
//$("#output").append($(this).html() + "<br />");
});