August 2015
Beginner
1075 pages
40h 42m
English
As with the DOM, you can traverse jQuery selected results based on child, sibling, or parent nodes. In fact, traversing your jQuery results is nearly the same as the DOM but with a few more methods at your disposal. The methods for traversing jQuery object nodes include .parent(), .parents(), .children(), .siblings(), .next(), and .prev().
As an example, the following shows finding all child nodes of <li> inside the navbar <ul> shown back in Listing 18.1. Recall that this example in the “Document Object Model (DOM)” section of the chapter was more than five lines of code to get this selection.
var sel = $('#navbar').children('li');
As you saw previously, ...
Read now
Unlock full access