zoukankan      html  css  js  c++  java
  • [ jquery 过滤器 .not(expr|obj|ele|fn) ] 筛选出与指定表达式不匹配的元素

    筛选出与指定表达式不匹配的元素:

    实例:

    <html lang='zh-cn'>
    <head>
    <title>Insert you title</title>
    <meta http-equiv='description' content='this is my page'>
    <meta http-equiv='keywords' content='keyword1,keyword2,keyword3'>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type='text/javascript' src='./js/jquery-1.12.1.min.js'></script>
    <style type="text/css">
        *{margin:0;padding:0;}
        html{font:400 15px/1.2em 'Courier New';color:#666;750px;margin:25px auto;}
        div > p{white-space: pre-wrap;margin:15px 0;}
        div >*{text-indent:8px;}
        .hover{color:#FF96EC;}
    </style>
    <script type='text/javascript'>
        $(function(){
            $('div').not(function(index){
              return  $('span',this).length == 1;
            }).attr({'style':'color:#000',}) ;
        });
    </script>
    </head>
    <body>
        <div id='demo'>
            <p>This is a p tag text presentation.</p>
            <p>This is a p tag text presentation.</p>
            <p>This is a p tag text presentation.</p>
            <div class='selectorDemoFirst' style='border:1px solid #925CE9;'>
                <p>This is a p tag text presentation.</p>
                <p>This is a p tag text presentation.</p>
            </div>
            <p>This is a p tag text presentation.</p>
            <div class='selectorDemoSecond' style='border:1px solid #999;margin-bottom: 45px;'>
                <span>This is a span tag text presentation</span>
                <p>This is a p tag text presentation.</p>
            </div>
            <div class='selectorDemoSecond' style='border:1px solid #925CE9;'>
                <span>This is a span tag text presentation</span>
                <p>This is a p tag text presentation.</p>
                <span style='padding:8px;'>This is a span tag text presentation</span>
            </div>
            <p>This is a p tag text presentation.</p>
        </div>
    </body>
    </html>
  • 相关阅读:
    HttpModule,HttpHandler,HttpHandlerFactory
    IHttpModule实现URL重写
    HttpModule与HttpHandler详解
    IHttpModule接口
    VS中新建网站和新建项目web应用程序的区别?(实际应用总结一点)
    slf4j简介
    SQL条件表达式
    Windows命令查看文件MD5
    Final对象
    Seasar2框架:AOP
  • 原文地址:https://www.cnblogs.com/mysearchblog/p/5616852.html
Copyright © 2011-2022 走看看