1. <!DOCTYPE html>
    2. <html lang="en">
    3. <head>
    4. <meta charset="UTF-8">
    5. <style>
    6. .active {
    7. color: red;
    8. }
    9. li {
    10. cursor: pointer;
    11. }
    12. </style>
    13. </head>
    14. <body>
    15. <ul>
    16. <li>第1li元素</li>
    17. <li>第2li元素</li>
    18. <li class="active">第3li元素</li>
    19. <li>第4li元素</li>
    20. </ul>
    21. <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    22. <script>
    23. var $active=$('.active');
    24. var $suoyou=$active.siblings()
    25. console.log($suoyou);
    26. </script>
    27. </body>
    28. </html>