JSFiddle - React, Tailwind, and code Playground
by anAgent
HTML
<span class="abcd"> something</span>
<div id="log"></div>
<button id="change">change</button>
JavaScript
(function () {
// basic helper to log when changes happen
var log = function (message) {
$("#log").append(message);
};
// the event that triggers the change
$('#change').on('click', function (e) {
$('.abcd').append('...more').trigger('change');
});
// the event that riggers the change
$('.abcd').on('change', function (e) {
log(new Date().toJSON() + ": this has changed</br>");
});
})();