JSFiddle - React, Tailwind, and code Playground

HTML

<script>
function validateForm()
        {
            valid = true;

            //validate first name
            if (document.contactform.first_name.value == "")
            {
                //alert user first name is blank
                alert("You must enter a first name");
                setTimeout(function() {
                    document.getElementById('first_name').focus()
                }, 10);
                
                return false;
            }
            return valid;
        }
</script>
<body>
<form name="contactform">
    <input type="text" name="first_name" id="first_name" maxlength="50" size="30" onBlur="validateForm()" />
    <input type="text" name="last_name" id="last_name" maxlength="50" size="30" />
</form>
</body>