JSFiddle - React, Tailwind, and code Playground

by devcurry_com

HTML

<div id="myDiv">This is a Div with an Attached Custom Event</div>
<button>Trigger custom event</button>
<br/><br/><br/>
Demo by <a href="http://www.devcurry.com/search/label/jQuery">DevCurry.com</a>

JavaScript

$('#myDiv').on('myEvent', function (e, somesampledata) {
                // write custom code
                $(this).text('Custom Event Triggered. ' + somesampledata);
            });

            $("button").click(function () {
                $("#myDiv").trigger("myEvent", "somedata");
            })