JSFiddle - React, Tailwind, and code Playground

by Chris Bouchard

HTML

<div id="foo">
    <div id="bar">Hello</div>
</div>

<div id="baz">World</div>

JavaScript

(function () {
    var foo = document.getElementById('foo');
    var bar = document.getElementById('bar');
    var baz = document.getElementById('baz');
    
    foo.addEventListener('click', function (event) {
        alert('Foo says: ' + event.testProp);
    });
    
    bar.addEventListener('click', function (event) {
        event.testProp = 'Hello world!';
        alert('Bar says: ' + event.testProp);
    });
    
    baz.addEventListener('click', function (event) {
        alert('Baz says: ' + event.testProp);
    });
})();