JSFiddle - React, Tailwind, and code Playground
by abdennour
HTML
<div class="old-teacher row">
I am old teacher in Row
</div>
<div class="old-teacher col">
I am Old Teacher in Col
</div>
<div class="new-teacher col">
I am new Teacher in Col
</div>
<hr >
<p>
Does the 1st DIV has class "Col" has another class starts with old <span id="result"></span>
</p>
</p>
CSS
#result{
color:red;
}
JavaScript
$.fn.hasClassStartsWith=function(prefix){
return $(this).is(`[class^=${prefix}]`);
};
document.getElementById('result').innerHTML=$('.col:eq(0)').hasClassStartsWith('old')?"Yes":"No";