I want to make it so that in my form the user cannot click the submit button until every field has an option selected. I originally tried this with a while loop and it created an infinite loop. I converted it to an if statement and added code to call the if statement every time something on the form is changed, but still the submit button never becomes clickable.
if(($('input[type=text]').val() === '') || (!($('input[name=class]').is(':checked'))) || (!($('input[name=race]').is(':checked')))) {
$(' input[type=submit]').css('pointer-events', 'none');
}
else{
$(' input[type=submit]').css('pointer-events', 'auto');
}
$('input[name=user]', 'input[name=race]', 'input[name=class]').change(function(){
if(($('input[type=text]').val() === '') || (!($('input[name=class]').is(':checked'))) || (!($('input[name=race]').is(':checked')))) {
$(' input[type=submit]').css('pointer-events', 'none');
}
else{
$(' input[type=submit]').css('pointer-events', 'auto');
}
});