//监听指定开关 form.on('switch(switchTest)', function(data){ console.log(data.othis.parents("tr").find("td").eq(1).text()) //id var userId=data.othis.parents("tr").find("td").eq(1).text(); var x=this.checked ? true:false; console.log(x) //console.log(data.othis.text()) if(x){ console.log("是,,,,,true") data.value=("1") console.log(data.value) }else{ console.log("否,,,,,true") data.value="2" console.log(data.value) } $.ajax({ url: '/UserUpdateForDelServlet', type: 'post', data: { "sfDel": data.value, "userId":userId }, dataType:"json", success:function (res) { console.log(res) } }); layer.msg('开关checked:'+ (this.checked ? 'true' : 'false'), { offset: '6px' }); // layer.tips('温馨提示:请注意开关状态的文字可以随意定义,而不仅仅是ON|OFF', data.othis) });
监听指定开关
最新推荐文章于 2022-01-27 09:40:31 发布