How to remove disable attribute from button when user types all info in input and checked checkbox?
My try:
FULL CODE: http://jsfiddle.net/7zMRM/1/
$('#id_accept').click(function(){
if($('#id_accept:checked').length == 1 && $('#id_blz').length == 8 && $('#id_account_owner').length > 3 && $('#id_account_number').length == 22 && $('#id_bank_name').length > 3){
$('#open').removeAttr('disabled');
$('#open').attr('onclick','javascript:yourFunctionName();');
}
else{
$('#open').removeAttr('onclick');
$('#open').attr('disabled','disabled');
}
});
First of all, you should not do this on:
So, you need to do on the
input‘schangeevent.Moreover, you haven’t wrapped the assignment inside
$(document).ready()and also, you have two forms.And also, you have to check for the checkbox value this way:
Another mistake is you should not use
.lengththat way, it should rather be:Final Code:
Fiddle: http://jsfiddle.net/7zMRM/2/