JSFiddle - React, Tailwind, and code Playground
HTML
<div id="box" class="test in-anwserbox">
click
</div>
JavaScript
$('#box').on('click',function() {
if(!$(this).is('[class*="answerbox"]')) {
alert('ok');
} else {
alert('has class');
}
});