JSFiddle - React, Tailwind, and code Playground by Bryson Murray April 10, 2019 HTML <script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.js"></script> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/ui-lightness/jquery-ui.css"> Click here to begin<br> JavaScript var window_focus; $(window).focus(function() { window_focus = true; }) .blur(function() { window_focus = false; }); $(document).one('click',function() { setInterval(function() { $('body').prepend('window has focus? ' + window_focus + '<br>' + 'document has focus? '+ document.hasFocus() + '<br>'); }, 1000); });