JSFiddle - React, Tailwind, and code Playground

by NicoO

HTML

<label for="nope">Nope</label>
<div>
    <input type="text" id="nope" />
</div>

<label for="test-field">Test</label>
<div>
    <input type="text" id="test-field" />
</div>

<label for="other">Other</label>
<div>
    <input type="text" id="other" />
</div>

JavaScript

$(function(){
    $("label:contains('Test')").next().children("input").focus();
});