jQuery破坏性方法end()是什么?

jQueryend()方法还原最近的破坏性操作,将匹配元素的集合更改为破坏性操作之前的先前状态。

这是您可以使用的方式,

operations.end()

示例

您可以尝试运行以下代码来了解jQuery破坏性方法end()

<html>
   <head>
      <title>jQuery end() function</title>
      <script src = "https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
       
      <script>
         $(document).ready(function(){
            $("p").find("span").end().css("border", "4px red solid");
         });
      </script>
       
      <style>
         p{
            margin:5px;
            padding:5px;
         }
      </style>
   </head>
   
   <body>
      <p><span>Hello</span> World!</p>
   </body>
   
</html>