JSFiddle - React, Tailwind, and code Playground

by notacouch

HTML

<input type='checkbox' id='try' >try
<button id='click'>Click</button>

JavaScript

$body = $('body');
$body.on('custom', "#try", function(event, data) {
     console.log('data?', data);
    if (!!data) {
        alert('A) not human')
    } else {
        alert('B) human');
    }
});
$body.on('click', '#try', function(event, data){
    $(this).trigger('custom', data);
});
$body.on('click', '#click', function(event) {
    $("#try").trigger('click', ['data here, or just a bool']);
});