JSFiddle - React, Tailwind, and code Playground

by Rich Costello

HTML

<form method="POST" action="">
    User Name: <input id="test2" name="Username" type="text" size="14" maxlength="14" /><br />
    Password: <input name="last_name" type="password" size="14" maxlength="14"><br />
    <input type="submit" value="Login" name="Submit" id="loggy">
    </form>

JavaScript

$(document).ready(function() {
    var $submit = $("input[type=submit]"),
        $inputs = $('input[type=text], input[type=password]');

    function checkEmpty() {
        return $inputs.filter(function() {
            return !$.trim(this.value);
        }).length === 0;
    }

    $inputs.on('keyup blur', function() {
        $submit.prop("disabled", !checkEmpty());
    }).blur();
});