// 监听checkbox
form.on('checkbox(change)',function(data){
var arr_box = [];
$('input[type=checkbox]:checked').each(function() {
arr_box.push($(this).val());
});
var str_arr = arr_box.toString(arr_box);
// console.log(strarr);
// console.log(arr_box.join(",")); 自定义分隔符
$("#chargess").val(str_arr);
});
//全选
form.on('checkbox(allChoose)', function (data) {
var child = $("input[name='test']");
child.each(function (index, item) {
item.checked = data.elem.checked;
// console.log($(this).val());
});
form.render('checkbox');
});
//单选
function exportsheet(){
var chk_value=[];
$('input[name="test"]:checked').each(function(){
chk_value.push($(this).val());
});
console.log(chk_value);
}
//全选
const checkboxes = document.getElementsByClassName('checkboxlist');
const selectedCheckboxes = [];
for(let i = 0; i < checkboxes.length; i++) {
if(checkboxes[i].type === 'checkbox' && checkboxes[i].checked) {
selectedCheckboxes.push(checkboxes[i].value);
}
}
版权属于:
小破孩
作品采用:
《
署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)
》许可协议授权
评论