JSFiddle - React, Tailwind, and code Playground

by ChrisStanyon

HTML

<div id="divBox">

<button id="childBtn">
Click Me
</button>


<p>
This should be clickable
</p>
</div>

JavaScript

$(document).on("click", "#childBtn", function (e) {
//$('#childBtn').on("click", function (e) {
   alert("Message from Button");
   e.stopPropagation()
});

$(document).on("click", "#divBox", function (e) {
//$("#divBox").on("click", function () {
   alert("Message from parent")
});