jquery实现全选反选功能

来源:互联网 发布:ubuntu 提权 编辑:程序博客网 时间:2024/05/09 00:53

全选功能

$(function () {
            $('#allchecked').click(function () {
                if ($('#allchecked:checked')) {
                    $('td input').attr('checked', true);

                }
                if (!$('#allchecked').attr('checked')) {

                    $('td input').attr('checked', false);
                }
            })

反选功能
            $('#Checkbox8').click(function () {
                if ($('#Checkbox8').attr('checked')) {
                    if ($('td input').attr('checked'))//选中的
                    {
                        var bufen = $('td input').each(function () {
                            $(this).attr('checked', !$(this).attr('checked'))
                        })
                    }
                }
              
            })

        })

原创粉丝点击