radio改变时触发事件

<input type="radio" value="1" checked="" name="purifyse">安装
<input type="radio" value="0" name="purifyse" >未安装

//改变
$(':radio').click(function(){
var showFlag = $('input:radio[name="purifyse"]:checked').val();
if(showFlag==1){
$("#purifyBox").removeClass("hide");
}
else {
$("#purifyBox").addClass("hide");
}
});

注:有些框架中对于input做了样式优化,点击时没有反应,查看是否隐藏真正的input。
参考链接:
cnblogs.com/z360519549/p/10628269.html
https://blog.csdn.net/aphy358/article/details/50250069?depth_1-utm_source=distribute.pc_relevant.none-task&utm_source=distribute.pc_relevant.none-task
https://blog.csdn.net/weixin_34185320/article/details/93572430

posted on 2020-03-12 14:52  七七2020  阅读(2405)  评论(0编辑  收藏  举报

导航