JSFiddle - React, Tailwind, and code Playground
HTML
<div style="height:40px; width:40px; background:red;" id="focus" onclick="myFunction()">
<form action="demo_form.asp">
<input type="text" style=" opacity: 0;" name="fname" ID="test">
</form>
<div>
<script>
function myFunction() {
alert('TEST');
$("#test").focus();
}
</script>