首页javascriptandselfjQuery Method - 如何使用andSelf添加当前节点

jQuery Method - 如何使用andSelf添加当前节点

我们想知道如何使用andSelf添加当前节点。

<html>
  <head>
    <script type="text/javascript" src='http://code.jquery.com/jquery-1.5.2.js'></script>
    <script type="text/javascript">
        $(document).ready(function(){
             $("div").andSelf().css("background", "yellow");
        });
    </script>
  </head>
  <body>
          <div>asdf</div>
          <div>asdf</div>
          <div>asdf</div>
          <div class="selected">asdf</div>
          <div>asdf</div>
  </body>
</html>