JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<label for="test-input">Test input</label>
<input id='test-input' value="" type="text" />
</form>
<div id="result">
<div>
<span>Number of focus: </span>
<span id="num-of-focus"></span>
</div>
<div>
<span>First focused: </span>
<span id="current-focus"></span>
</div>
</div>
JavaScript
window.setInterval(function(){
$('#num-of-focus').text($(':focus').size());
$('#current-focus').text($(':focus').prop('tagName'));
}, 500);
setTimeout(function(){
$('#other-elm').text('Modified').css('color','red');
}, 2000);
setTimeout(function(){
$('#other-elm').text('Modified <- Set focus here');
$('#other-elm').focus();
}, 3000);