$(function () {
$("#subt").val("保存");
var namearry = [];//定义空数组


$('.ListMid').on('click', function (index) { //事件绑定 
if ($(this).is(":checked")) {/确认是否勾选
namearry.push($(this).attr("mid"));//勾选的都添加到数组里
$("#hd_selectValue").val(namearry);//值存放在隐藏域方便后台获取
}
else {
function delItem(item, list) {//遍历删除指定取消的勾选框
list.splice(list.indexOf(item), 1)
}
delItem($(this).attr("mid"),namearry)//删除指定的值
$("#hd_selectValue").val(namearry);//重新返回到隐藏域存储
}
/*
if ($(this).is(":checked")) {
// alert("选中");
namearry.push($(this).attr("mid"));
$("#hd_selectValue").val(namearry);
} else if($(this).prop("checked",false)){
//alert("取消");
}*/

});
})

相关文章:

  • 2021-12-20
  • 2021-12-06
  • 2021-11-14
  • 2021-09-30
  • 2022-12-23
  • 2021-06-20
猜你喜欢
  • 2022-12-23
  • 2021-12-01
  • 2021-11-17
  • 2021-09-21
  • 2022-12-23
相关资源
相似解决方案