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