I have this piece of code I’ve been working on but there’s a problem, here’s the code:
$('form input').keyup(function () {
if($(this).hasClass('field-error')){
$('.btn').addClass('no-submit').removeClass('btn');
$('.error-notify').show();
}
else{
$('.no-submit').addClass('btn').removeClass('no-submit');
$('.error-notify').hide();
$('.btn').click(function(){
$(this).parent().find('form').submit();
});
}
});
What I’d like to happen is..when all form inputs(x5) have been checked and there are no instances of any form inputs having the ‘.field-error’ class the then .btn class becomes clickable and the form can be submitted
If you’d like me to further make clear what I mean, just let me know.
Any help is greatly appreciated, Thanks
Change this line:
To this:
I think this is what you want (see this Updated Fiddle), though am not totally sure. From what I can see it doesn’t disable when the field = ‘?’.