var obj = $(this).closest('li').find(':checkBox'); var childCount=$(obj).size(); var checkedCount=$(obj).(':checked').length;
我在checkedCount上收到错误
??
filter()
var obj = $(this).closest('li').find(':checkBox'); var childCount = obj.size(); var checkedCount = obj.filter(':checked').length;
filter Reduce the set of matched elements to those that match the selector or pass the function’s test.
此外,您不需要使用$()包装obj,因为它已经是一个jQuery对象.