ITeye博客

jquery全选反选

yanghaiskys · 2009-06-01 09:29 · Jquery · jQuery · Markdown

<input type="button" class="btn_selectallbg" id="checkall2" value="全选" />

<input type="checkbox"  name="groupId[]"  value="遍历的某列值 " />

 

 // 给全选按钮添加全选功能
    $('#checkall2').toggle(function(){
            $("input[name='groupId[]']").each(function(){
                $(this).attr('checked',true);
            });
            $(this).attr('value','取消');
        },function(){
            $("input[name='groupId[]']").each(function(){
                $(this).attr('checked',false);
            });
            $(this).attr('value','全选');
        }

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。