JSFiddle - React, Tailwind, and code Playground
HTML
<form id="loginform">
<input type="text" name="email" id="email">
<input type="password" name="password" id="password">
<input type="submit" id="submit">
</form>
JavaScript
$(function(){
function validate(){
if($('#email').val() !== '' && $('#password').val() !== '')
$('#submit').prop('disabled', false);
else
$('#submit').prop('disabled', true);
}
// Validate after user input
$('#email, #password').on('keyup change', validate);
// Validate on mouse enter of body and login form
// to catch auto-fills from roboform/1password etc...
$('body, #loginform').on('mouseenter', validate);
// Validate onload incase of autocomplete/autofill
validate();
});