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);

  • 相关阅读:
    积分图像
    [悟] 因上努力,果上随缘(转)
    不要走的太匆忙( 转)
    一个程序员如何快速赚到一百万?(转)
    vi文字处理器
    Linux常用命令
    Hadoop之MapReduce
    Hadoop全分布模式操作
    Hadoop之HDFS
    Hadoop生态系统
  • 原文地址:https://www.cnblogs.com/angellating/p/4775935.html
Copyright © 2011-2022 走看看