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 = $("#log:empty").length + $('#password:empty').length ;
alert(tag)
$("#foo").prop('disabled',tag?'':'disabled');
}
})