O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting Siblings

$(".menu").siblings("span")   //selects all <span> elements that are   //siblings to elements with class="menu"

The .siblings([selector]) method returns a jQuery object representing all the sibling objects for each element in the current set. An optional selector argument allows you to limit the results to those siblings matching the selector.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required