jQuery element ~ siblings Selector Last Updated : 11 Jul, 2025 Suggest changes Share Like Article Like Report The element ~ siblings selector in jQuery is used to select all elements that are siblings of the specified element. Syntax: ("element ~ siblings")Parameter: It contains two parameters as mentioned above and described below: element: It is a required parameter and is used for any valid jQuery selector.siblings: It is a required parameter and is used for specifying the siblings of the element parameter.Example 1: HTML <!DOCTYPE html> <html> <head> <title> jQuery element ~ siblings Selector </title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h2>jQuery element ~ siblings Selector</h2> <p>Geeks1</p> <div> <p>Geek2</p> <p>Geeks3</p> </div> <p>Geek4</p> <p>Geeks5</p> <div> <p>Geek6</p> </div> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script> $(document).ready(function () { $("div ~ p").css("background-color", "green"); }); </script> </body> </html> Output: Example 2: HTML <!DOCTYPE html> <html> <head> <title> jQuery element ~ siblings Selector </title> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksforGeeks </h1> <h2>jQuery element ~ siblings Selector</h2> <p>Geeks1</p> <div> <p>Geek2</p> <p>Geeks3</p> </div> <p>Geek4</p> <p>Geeks5</p> <div> <p>Geek6</p> </div> <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"> </script> <script> $(document).ready(function () { $("p ~ div").css("border", "2px solid red"); }); </script> </body> </html> Output: S shubhamsingh10 Follow Article Tags : Web Technologies JQuery jQuery-Selectors Explore jQuery Tutorial 8 min read Getting Started with jQuery 4 min read jQuery Introduction 7 min read jQuery Syntax 2 min read jQuery CDN 4 min read jQuery SelectorsJQuery Selectors 5 min read jQuery * Selector 1 min read jQuery #id Selector 1 min read jQuery .class Selector 1 min read jQuery EventsjQuery Events 4 min read jQuery bind() Method 2 min read jQuery blur() Method 1 min read jQuery change() Method 2 min read jQuery EffectsjQuery animate() Method 2 min read jQuery clearQueue() Method 2 min read jQuery delay() Method 2 min read jQuery HTML/CSSjQuery addClass() Method 2 min read jQuery after() Method 1 min read jQuery append() Method 2 min read jQuery TraversingjQuery | Traversing 4 min read jQuery add() method 1 min read jQuery addBack() Method 2 min read My Profile ${profileImgHtml} My Profile Edit Profile My Courses Join Community Transactions Logout Like