zoukankan      html  css  js  c++  java
  • Jquery中的prop()方法 全选或全不选

     注意: prop()在高版本才会有效, 低版本用attr();
     $(function(){
            // 元素checkbox
            var aChecked = $('.checkGoods');
            // 全选
            var oAllSelected = $('#checkAll');
    
            oAllSelected.click(function() {
                var $this = $(this);
    
                if( $this.prop('checked') ) {
                    aChecked.each(function() {
                        $(this).prop('checked', true);
                    });
                } else {
                    aChecked.each(function() {
                        $(this).prop('checked', false);
                    });
                }
            });
    
        })

            aChecked.each(function() {
                    $(this).prop('checked', !$(this).prop('checked'));
           });
    

      

      

  • 相关阅读:
    hdu1085
    hdu1028
    hdu2189
    母函数
    博弈论
    nginx安装
    学习好站点
    nginx在linux下安装
    wget 命令用法详解
    U盘安装CentOS7的帖子
  • 原文地址:https://www.cnblogs.com/zsongs/p/5562531.html
Copyright © 2011-2022 走看看