I have this Fiddle and i made the script to work when the check box is checked first and than text inserted in input,but if i try to insert text first button wont enable it self. Can someone look at that fiddle? this is my script
$('.checkset label').on('change', function () {
var reqlength = $('.important').length;
console.log(reqlength);
var value = $('.important').filter(function () {
return this.value != '';
});
if ($('.checkset label').hasClass("checked")) {
if (value.length >= 0 && (value.length !== reqlength)) {
//alert('Please fill out all required fields.');
$('#reg').prop('disabled', true);
$('#reg').addClass('inactive');
} else {
//alert('Everything has a value.');
$('#reg').prop('disabled', false);
$('#reg').removeClass('inactive');
}
} else {
$('#reg').prop('disabled', true);
$('#reg').addClass('inactive');
}
});
$(".important").on('change', function () {
$('.checkset label').change();
});