JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
    
    <button class="btn">Click Me!</button>
    
</div>

<button class="btn">Click Me!</button>

JavaScript

$('button').click(function(){
    var x = $(this).parent();
    if (!x.is('body')) {
        console.log("It has it!");
    } else {
        console.log("It does not have it!");
    }
});