实时记要checkbox选中个数的jquery实现

实时记录checkbox选中个数的jquery实现??????? 实时统计当前选中checkbox个数,为每个循环中的checkbox加载

实时记录checkbox选中个数的jquery实现

??????? 实时统计当前选中checkbox个数,为每个循环中的checkbox加载onclick()事件,调用countTotal()函数,并且定义一个<span></span>的id为current,则可以在此<span></span>内显示当前选中个数,初始值设为0.

// 统计当前选中人数function countTotal(){var count = 0;$.each($("input[name='checkbox[]']:checked"), function() {count = count + 1;});$("#current").html(count);}
1 楼 struts 2010-08-12   直接$("input[name='checkbox[]']:checked").length 2 楼 flyer0126 2010-08-13   struts 写道直接$("input[name='checkbox[]']:checked").length
恩,不错,学习了~~