JSFiddle - React, Tailwind, and code Playground

by pepelsbey

HTML

Focus textarea then focus out of the iframe window (click on code)
<br>
Correct sequence of events:
<pre>
window focus
textarea focus
textarea click
textarea blur
window blur
</pre>
<hr />
<textarea placeholder="Focus me"></textarea>
<pre class="log"></pre>

JavaScript

function log(str) {
    $('.log').append(str + '\n');
}

$(window).bind('focus blur', function (event) {
    log('window ' + event.type);
});


$('textarea').bind('click focus blur', function (event) {
    log('textarea ' + event.type)
})