zoukankan      html  css  js  c++  java
  • 用jQuery实现(全选、反选、全不选功能)

    在jQuery选择器的基础下我们实现一个全选,反选,全不选功能!

        <script type="text/javascript">
            $(function ()
            {
                //全选
                $("#selectAll").click(function () {
                    //attr在HTML推荐非固有(用户自定义)属性是使用
                    //prop在HTMl元素固有属性的时候使用
                    $("input[name='gx']").each(function () {//input[name='gx']属性过滤选择器
                        $(this).prop("checked", true);
                    })
                });
                //全不选
                $("#selectNotAll").click(function () {
                    $("input[name='gx']").each(function () {
                        $(this).prop("checked", false);
                    })
                });
                //反选
                $("#selectRevorse").click(function ()
                {
                    $("input[name='gx']").each(function ()
                    {
                        $(this).prop("checked",!this["checked"]);
                    });
                })
            })
        </script>

  • 相关阅读:
    MySQL性能优化的最佳经验
    18个网站SEO建议
    sql之left join、right join、inner join的区别
    PHP与MYSQL事务处理
    Firefox上Web开发工具库一览
    SphinxSE的安装
    python XML
    python yaml
    C语言文本处理
    Linux strace命令
  • 原文地址:https://www.cnblogs.com/qinwenfeng/p/9497116.html
Copyright © 2011-2022 走看看