现在需要对模态框关闭时判断是否修改,若修改了提示保存
function getRoleList() {
$("input[name='btSelectItem']").each(function (d) {
if($(this).prop("checked")) {
console.log($(this).val());
if($(this).val()!="on") {
list2.push($(this).val());
console.log(list2.length);
}
}
});
}
function unSaveClose() {
var list = new Array();
$("input[name='btSelectItem']").each(function (d) {
if($(this).prop("checked")){
if($(this).val()!="on"){
list.push($(this).val());
}
}
});
if(list.length!=list2.length)
// if(list.length!=0)
{
var index = layer.alert('请确认权限,选择关闭',{
btn: ['关闭',"取消"] //按钮
上面的方法是模态框打开时自动加载,但是却不能循环获取checkbox的值,只能获取到一次on
下面是点击关闭按钮时调用,可以获取所有选中的值
我现在是想先获取刚打开时的已选中框的长度与关闭时的选中框的长度判断是否修改,但是getRoleList() 却获取不了,两个方法都没有其他的调用
求解啊啊,没有分了,请大佬赐教