Rohan  Rathore
What is .siblings() method in jQuery?
By Rohan Rathore in JQuery on May 07 2013
  • Tanul Bhasin
    May, 2014 7

    .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:- 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'.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS