jquery实现checkbox全选反选

 <script type="text/javascript">
        $(function () {
            $("#allcheck").click(function () {
                if ($("#allcheck").attr("checked")) {
                    $("#jobtable").find(":checkbox").each(function () {
                        if ($(this).attr("id") != "allcheck")
                            $(this).attr("checked", true);
                    });
                } else {
                    $("#jobtable").find(":checkbox").each(function () {
                        // if ($(this).attr("id") != "allcheck")
                        $(this).attr("checked", false);
                    });
                }
            });
        });
        
    </script>

posted on 2011-12-02 17:03  larryle  阅读(85)  评论(0)    收藏  举报