JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<p>ABC</p>
<p>
<q>123</q>
</p>
<p>ABC</p>
</div>
JavaScript
$(function() {
$('p:not(:has(q))').css({
backgroundColor: '#f00'
});
});
<div>
<p>ABC</p>
<p>
<q>123</q>
</p>
<p>ABC</p>
</div>
$(function() {
$('p:not(:has(q))').css({
backgroundColor: '#f00'
});
});