JSFiddle - React, Tailwind, and code Playground
HTML
<div id="parent">
Some content
<div id="child">Some other content</div>
</div>
<button id="clickMe">
Toggle child
</button>
CSS
#parent {background:red;width:200px;height:200px;}
#child {display:none;background:blue;width:50px;height:50px;}
#child.display {display:block;}
JavaScript
$('#clickMe').click(function()
{
$('#child').toggleClass('display');
});
$('#parent').click(function()
{
if($('#child').data('clicked') == true )
{
// do nothing
} else
{
$('#child').toggleClass('display');
}
});