JSFiddle - React, Tailwind, and code Playground
by DamonOehlman
HTML
<html>
<body>
<ul id="status"></ul>
<div id="div1">
<div id="div2">
<button id="btnAdd">Add</button>
<button id="btnRemove">Remove</button>
</div>
</div>
</body>
</html>
JavaScript
var button = document.getElementById('btnAdd');
function handleEvent(eventName) {
return function(evt) {
$('#status').append('<li>' + eventName + ': ' + evt.target.id + '</li>');
}
}
button.addEventListener('click', handleEvent('button'), true);
document.addEventListener('click', handleEvent('document'), true);