layui单选框verify_layui单选框去掉选中状态

//首先把页面初始化的已选中单选框添加一个自定义属性xxx

$(":radio").each(function(){

if($(this).prop("checked")){

$(this).attr("checkdata","checkdata");

}

});

//$('#formTest').on('click','.layui-anim.layui-icon',function () {

//根据表单id formTest添加一个动态绑定的单击事件,如果不动态绑定,form.render("radio")页面重新渲

//染之后,绑定的事件会被删除,如果页面绑定的有其他交互事件请测试一遍,防止事件不起作用

//下面的name=orderPlaystyle,name=orderPump是因为有两个单选框分组,如果有多个分组你也要复制成多个

$('#formTest').on('click','.layui-anim.layui-icon',function () {

var radioDOM=$(this).parent().parent().find("[title="+$(this).parent().find("div").text()+"]");

if($(radioDOM).attr("name")=="orderPlaystyle"){

if(typeof($(radioDOM).attr("checkdata"))=="undefined"){

$(":radio[name=orderPlaystyle]").removeAttr("checkdata");

$(radioDOM).attr("checkdata","checkdata");

}else{

$(":radio[name=orderPlaystyle]").removeAttr("checkdata");

$(radioDOM).prop("checked",false);

form.render("radio");

}

}else if($(radioDOM).attr("name")=="orderPump"){

if(typeof($(radioDOM).attr("checkdata"))=="undefined"){

$(":radio[name=orderPump]").removeAttr("checkdata");

$(radioDOM).attr("checkdata","checkdata");

}else{

$(":radio[name=orderPump]").removeAttr("checkdata");

$(radioDOM).prop("checked",false);

form.render("radio");

}

}

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值