使用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代码不生效


免责声明!

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



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