zoukankan      html  css  js  c++  java
  • .filter(function(index)

    注意index是从0开始的,A function used as a test for each element in the set. this is the current DOM element.0-based

    <!DOCTYPE html>
    <html>
    <head>
    <style>
    div
    { width:60px; height:60px; margin:5px; float:left;
    border
    :3px white solid; }
    </style>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
    </head>
    <body>

    <div id="first"></div>
    <div id="second"></div>
    <div id="third"></div>

    <div id="fourth"></div>
    <div id="fifth"></div>
    <div id="sixth"></div>
    <script>
    $(
    "div").css("background", "#b4b0da")
    .filter(
    function (index) {
    return index == 1 || $(this).attr("id") == "fourth";
    })
    .css(
    "border", "3px double red"); 、、

    change the color of all divs; then add a border to the second one (index == 1) and the div with an id of "fourth."



    </script>

    </body>
    </html>



  • 相关阅读:
    delphi参数传递
    Delphi OO
    Delphi Excel
    Delphi Register
    西安前端交流会
    web前端开发教程系列-4
    web前端开发教程系列-3
    web前端开发教程系列-2
    web前端开发教程系列-1
    露个脸
  • 原文地址:https://www.cnblogs.com/youxin/p/2291407.html
Copyright © 2011-2022 走看看