过滤器的操作

1.不能有空格,空格表示索引为1的

   :first

   :last

   :gt(5) 索引大于5的标签

   :lt(5)索引小于5的标签

    :header:选取h1h2h3h4h5之类的标签

    :eq(5):索引等于5的标签

   :not(selector1):

   :even 偶数标签

   :odd  奇数标签

<script type="text/javascript">

        $(function () {
            //选取所有的p元素
            //$('p').css('backgroundColor', 'red');
            //选取首个p元素设置属性
            //$('p:first').css('backgroundColor', 'red');
            //选取最后一个p元素设置属性
            //$('p:last').css('backgroundColor', 'red');
            //选取偶数元素
            //$('p:even').css('backgroundColor', 'red');
            //选取奇数元素
            //$('p:odd')css('backgroundColor', 'red');
            //索引大于2的元素
            //$('p:gt(2)')css('backgroundColor', 'red');
            //索引小于3的元素
            //$('p:lt(3)')css('backgroundColor', 'red');
            //选取页面上所有的p元素,除了应用了cls类的那些p元素
            //$('p:not(.cls)').css('backgroundColor', 'red');
            //选取header标签,即选择h1....等标签
            //$('h1,h2,h3').css('backgroundColor', 'red');
            //$(':header').css('backgroundColor', 'red');
        })
    </script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值