input 单选按钮radio 取消选中


//需要先引入JQ.js
 <input name="rdo" value="AA" type="radio" tag="0" />A <br /> <input name="rdo" value="BB" type="radio" tag="0" />B <br /> <input name="rdo" value="CC" type="radio" tag="0" />C <script> $(":radio").click(function () { var r = $(this).attr("name"); $(":radio[name=" + r + "]:not(:checked)").attr("tag", 0); if ($(this).attr("tag") == 1) { $(this).siblings().attr("checked", false); $(this).attr("checked", false); $(this).attr("tag", 0); $(this).siblings().attr("tag", 0); } else { $(this).attr("tag",1); $(this).siblings().attr("checked", false); $(this).siblings().attr("tag", 0); } }); </script>


 
原文地址:https://www.cnblogs.com/wei-dong/p/6084211.html