我有一组复选框,它们具有data-groupid
和data-multichoice
属性。根据“数据”属性启用或禁用复选框
组1:data-groupid= "1" data=multichoice="0"
(10盒)
组2:data-groupid= "2" data=multichoice="0"
(10盒)
如何取消在一个组中的所有箱子一次?
//function will catch any click on any checkbox with class=lvl
$('.lvl').click(function() {
//check if box was checked
if ($(this).is(":checked")) {
//check if data-attribute is NOT a multi-choice
if (!($(this).data("multichoice"))) {
//disable all checkboxes that have the same group-id
$(this).data("groupid") ... HELP HERE
}
}
});
你为什么不使用无线电盒代替 –