 
                        | <input type="checkbox"> | 女 | 20 | 
| <input type="checkbox"> | men | 20 | 
| <input type="checkbox"> | men | 30 | 
| <input type="checkbox"> | 女 | 20 | 
| <input type="checkbox"> | 女 | |
| <input type="checkbox"> | 33333 | 
<button>aa</button> <button>bb</button>
var box = $('tbody input[type=checkbox]');
            var    size = box.length;//取总个数  
                    
            var    chked = box.filter(':checked').length;//取选中的个数
    
      $('button:contains(aa)').click(function(){
     
          console.log(chked);
          console.log(size);
      
      });
为什么输出的选中的个数为0?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
刚好下午整理了这个。
checkbox系列的操作jQuery操作checkbox
你要把获取个数的代码也放进click中。