jQuery控制checkbox全选 反选 全不选

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

$(function () {  

            $("#selectAll").click(function () {//全选  

                $("#playList :checkbox").attr("checked", true);  

            });  

  

            $("#unSelect").click(function () {//全不选  

                $("#playList :checkbox").attr("checked", false);  

            });  

  

            $("#reverse").click(function () {//反选  

                $("#playList :checkbox").each(function () {  

                    $(this).attr("checked", !$(this).attr("checked"));  

                });  

            });  

        });



转载于:https://my.oschina.net/leonaLily/blog/398618

你可能感兴趣的:(jQuery控制checkbox全选 反选 全不选)