JSFiddle - React, Tailwind, and code Playground
HTML
<button id="btn1">set Focus on link</button><a id="link" href="#">foo bar</a>
<br><br>
<button id="btn2">set Focus on input</button><input id="input" value="foo bar"/>
<br><br>
<b>Active Element:</b> <span id="span">nothing yet</span>
CSS
#link:focus {
background-color: red;
}
#input:focus {
background-color: blue;
}
JavaScript
$('#btn1').click(function(){
$('#link').focus();
$('#span').text('link has focus');
});
$('#btn2').click(function(){
$('#input').focus();
$('#span').text('input has focus');
});