I have a Fiddle , and I ran the script when this box is checked first and the text is inserted into the input, but if I try to insert the text, the first button will not turn it on. Can someone look at this 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)) {
$('#reg').prop('disabled', true);
$('#reg').addClass('inactive');
} else {
$('#reg').prop('disabled', false);
$('#reg').removeClass('inactive');
}
} else {
$('#reg').prop('disabled', true);
$('#reg').addClass('inactive');
}
});
$(".important").on('change', function () {
$('.checkset label').change();
});
source
share