Created
December 13, 2012 21:39
-
-
Save jlittlejohn/4280198 to your computer and use it in GitHub Desktop.
JS: Traversing the DOM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("div#home").prev("div"); // find the div previous in relation to the current div | |
$("div#home").next("ul"); // find the next ul element after the current div | |
$("div#home").parent(); // returns the parent container element of the current div | |
$("div#home").children("p"); // returns only the paragraphs found inside the current div |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment