使用jquery实现单选框多选框取消选中状态
Posted super超人
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用jquery实现单选框多选框取消选中状态相关的知识,希望对你有一定的参考价值。
function radioReset(){ /*方式一*/ /* var radios = $("input[type=‘radio‘]"); for (i=0; i<radios.length; i++){ if(radios[i].checked){ radios[i].checked = false; } } */ /*方式二*/ $("input[type=‘radio‘]").removeAttr(‘checked‘); }
<input type="button" class="button_gray" value="重 填" onclick="radioReset();">
切记 :如果在input类型为reset的上面添加onclick="radioReset();"如:
<input type="reset" class="button_gray" value="重 填" onclick="radioReset();">
取消选中的js代码不生效
以上是关于使用jquery实现单选框多选框取消选中状态的主要内容,如果未能解决你的问题,请参考以下文章
Jquery获取列表中的值和input单选多选框控制选中与取消
Layuilayui 单选框多选框radio 元素判断是必填项 lay-verify=‘required‘
Layuilayui 单选框多选框radio 元素判断是必填项 lay-verify=‘required‘