1 回答
TA貢獻1765條經驗 獲得超5個贊
所以我設法讓它工作,經過多次撓頭,我將計數更改為 1,這解決了問題。全面測試它現在按預期執行。
// Checks individual checkboxes and displays the count
$(".individual").on("change", determineActionButtonAvailability);
$(".selectall").click(function () {
$(".individual").prop("checked", $(this).prop("checked"));
determineActionButtonAvailability();
});
//Disable Top Verify Button if two or more checkboxes are selected.
$('.verify-btn').prop('disabled', true);
$(".individual").on("click", function () {
if ($(".individual:checked").length > 1) {
$('.verify-btn').prop('disabled', false);
}
else {
$('.verify-btn').prop('disabled', true);
}
});
//Disable Action Button in the columns when more than one checkbox is selected
$('.table-btn').prop('disabled', false);
$(".individual").on("click", function () {
if ($(".individual:checked").length > 1) {
$('.table-btn').prop('disabled', true);
}
else {
$('.table-btn').prop('disabled', false);
}
});
// When one or more works are selected, will enable the top action menu.
// Will disable when none selected.
function determineActionButtonAvailability() {
if ($(".individual:checked").length > 1) {
$(".records-selected").show();
$("#selected").text($(".individual:checked").length);
$("#total").text($(".individual").length);
$(".verify-btn").prop('disabled', false);
$(".table-btn").prop('disabled', true);
}
else {
$(".records-selected").hide();
$(".verify-btn").prop('disabled', true);
$(".table-btn").prop('disabled', false);
}
}
- 1 回答
- 0 關注
- 252 瀏覽
添加回答
舉報
