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>

 

 

 

posted @ 2016-11-21 08:32  进军码农  阅读(609)  评论(0编辑  收藏  举报