JSFiddle - React, Tailwind, and code Playground

by f0t0n

HTML

<div>
    <input type="text" id="txt" />
    <input type="button" id="btn" value="Button" />
</div>

<div>
    <textarea id="consoleArea"></textarea>
</div>

CSS

div {
    margin: 5px;
}
textarea {
    width: 512px;
    height: 256px;
}

JavaScript

var txt$ = $('#txt'),
    btn$ = $('#btn'),
    console$ = $('#consoleArea');

function log(s) {
    console$[0].value += s + "\n";
}

txt$.on('blur', function(e) {
    btn$.trigger('click', true);
});
btn$.on('click', function(e, isTriggered) {
    log('has been triggered: ' + (isTriggered || false));
});