JSFiddle - React, Tailwind, and code Playground

by 20yco

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>

<button>
sdf
</button>

JavaScript

var window_focus;

$(window).focus(function() {
    window_focus = true;
		$('button').trigger("click");

}).blur(function() {
    window_focus = false;
});


$('button').click(function() {
  $('body').append('has focus');
});