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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM