C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
.NET
ADO.NET
Android
ASP.NET
C#
Databases & DBA
Design Patterns & Practices
iOS
Java
OOP/OOD
SharePoint
Software Testing
Web Development
WPF
View All
1
Reply
What is .siblings() method in jQuery?
Rohan Rathore
12y
7k
0
Reply
Delete Row
Delete Column
Insert Link
×
Insert
Cancel
Embed YouTube Video
×
Width (%)
Height (%)
Insert
Cancel
Table Options
×
Rows
Columns
First row as header
Create Table
Insert Image
×
Selected file:
Alignment
Left
Center
Right
Select an image from your device to upload
Upload to Server
Cancel
Submit
.siblings() method allows us to search through the siblings of the elements on which jquery logic is performed. Use this editor:- http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_siblings And run this code:-
siblings demo
list item 1
list item 2
list item 3
list item 4
list item 5
list item 1,list item 2,list item4,list item 5 will highlight. These are none other than siblings of list item3. In the same way you can change the above written jquery to:- "$( "li" ).siblings('.third-item').css( "background-color", "red" );" Theis will highlight the list item 3 because it is now searching the sibling of li whose class is '.third-tem'.
Tanul Bhasin
11y
0
Message