jquery、js全选反选checkbox

操作checkbox,全选反选

 1     //全选
 2     function checkAll() {
 3         $('input[name="TheID"]').attr("checked", "checked");
 4     }
 5     //反选
 6     function uncheckAll() {
 7         $('input[name="TheID"]').each(function() {
 8             this.checked = !this.checked;
 9         })
10     }
11     //获取选中的项
12     function getCheck(){
13         var check = $('input[name="TheID"]:checkbox').map(function() {
14                 return $(this).val();
15             }).get().join(',');
16         return check;
17     }
View Code

 

 

posted @ 2014-03-11 14:32  贾锡安  阅读(282)  评论(0编辑  收藏  举报