zoukankan      html  css  js  c++  java
  • 刷新的时候jquery获取checkbox是否为选中和设置选中

    $(document).ready(function(){
        $('.uninstall_list_checkbox').click(function(){
            if($(this).parent('.uninstall_list').children('input').attr("checked")==true){ //判断是否选中
                $(this).parent('.uninstall_list').children('input').attr('checked',false); //设置未选中
            }
            else
            {
                $(this).parent('.uninstall_list').children('input').attr('checked',true);
            }
            /*if (!$(this).hasClass("checked")) { //判断是否有class为checked
                $(this).addClass("checked");   //添加class
                $(this).parent('.uninstall_list').children('input').attr('checked',true);  //设置复选框选中
            }
            else {
                $(this).removeClass("checked");
                $(this).parent('.uninstall_list').children('input').attr('checked',false);
            }*/
        });
    });

    判断checkbox是否为选中还有这种方法:

    if($(this).parent('.uninstall_list').children('input').is(":checked"));

    设置就是:$(this).parent('.uninstall_list').children('input').attr('checked',false);

  • 相关阅读:
    需要我们了解的SQL Server阻塞原因与解决方法
    SQL Server应用模式之OLTP系统性能分析
    第一章 scala环境搭建
    IO
    装饰器模式
    java 泛型方法
    文件格式转换
    spring ioc
    深入浅出Java模式设计之模板方法模式
    struts2
  • 原文地址:https://www.cnblogs.com/angellating/p/4775935.html
Copyright © 2011-2022 走看看