JSFiddle - React, Tailwind, and code Playground

HTML

<form>
    <input type="text" id="log" />
    <input type="text" id="password" />
    <input type="button" value="test" id="foo" disabled="disabled" />
    <input type='text' value='' id="bar" />
</form>

JavaScript

tabids = new Array('log', 'password');
$('form').click(function (e) {
    if ($.inArray(e.target.id, tabids) == -1) {
        var tag = $.trim($("#log").val()).length > 0 && $.trim($('#password').val()).length > 0;


        $("#foo").prop('disabled', tag ? '' : 'disabled');
    }
})