jQuery 实现全选全不选

html代码

1 <input type="checkbox" class="sellist" onclick="selectAll(this)">全选
2 <input type="checkbox" class="sellist">
3 <input type="checkbox" class="sellist">
4 <input type="checkbox" class="sellist">
5 <input type="checkbox" class="sellist">
6 <input type="checkbox" class="sellist">

js代码

1 //全选
2 function selectAll(checkbox) {
3    $('input[type=checkbox]').prop('checked', $(checkbox).prop('checked'));
4 }

 

 

posted @ 2013-11-15 17:12  海洋宝宝  阅读(121)  评论(0)    收藏  举报