JSFiddle - React, Tailwind, and code Playground

by richardneililagan

HTML

<input id="txtbox" type="text" value="FOOOOOBAR" /><br/>
<span id="focustype"></span>

JavaScript

$(function() {
    
    var isClick;
    
    $(document)
        .bind('click', function() { isClick = true; })
        .bind('keydown', function() { isClick = false; })
        ;
    
    function handler() 
    { 
        $('#focustype').text(isClick ? "CLICK" : "TAB");
    }
    
    $('#txtbox').focus(function(){
        setTimeout(handler,100);
    });
    
    
});