Disable / Enable Button dengan cek panjang array jquery
Laravel 2023-01-26
===================
$(document).ready(function() {
var tmp = [];
$("input[type='checkbox']").change(function() {
var checked = $(this).val();
if ($(this).is(':checked')) {
tmp.push(checked);
} else {
tmp.splice($.inArray(checked, tmp), 1);
}
var res = tmp.length;
// console.log(res);
if (res > 0) {
$('#submit').prop('disabled', false);
} else if (res == 0) {
$('#submit').prop('disabled', true);
}
});
});
==================