JSFiddle - React, Tailwind, and code Playground

HTML

<select>
    <option value="">Select me</option>
    <option value="1" selected="selected">1</option>
</select>
<input type='radio' />
<input type='text' />
<input type='checkbox' checked=""/>
<input type='text' value=' howdy ' />
<input type='button' />
<textarea></textarea>

JavaScript

$("input:enabled,select:enabled,textarea:enabled").filter(function () {
    return this.type.match(/checkbox|radio/i) && //when it's a checkbox/radio
        !this.checked || //get me a list of unselected ones
        ($.trim(this.value) === ""); // else get me a list of empty inputs
}).first().focus(); //grab the fist from the list and set focus