The examples in this article describe the usage of siblings in jQuery. Share it with everyone for your reference, the details are as follows:
The so-called siblings, the English translation is brother nodes. So the name implies, it is to get the sibling nodes of a certain element (excluding itself).
<html> <head> <script type="text/javascript" src="/jquery/jquery.js"></script> </head> <body> <ul> <li>li1</li> <li>li2</li> <li id="li3">li3</li> <li>li4</li> <li>li5</li> </ul> <script> $("#li3").siblings("li").css("backgroundcolor", "yellow"); </script> </body> </html>
We also know,
in this case can be written as
By default, it takes the same sibling element as itself.
I hope this article will be helpful to everyone in jQuery programming.