December 2013
Intermediate to advanced
384 pages
9h 54m
English
var pars = $("p"); //contains all <p> elements var pAndDiv = $("div").add(pars); //contains all <div> and <p> elements var pAndDivAndSpan = $("span").add("p").add("div"); //contains all <span> and <div> and <p> elements
A great feature of jQuery is how easy it is to add additional elements to the jQuery object set. The .add(selector) method adds elements that match the selector to the set represented by the jQuery object.
The .add(object) method accepts another jQuery object and adds the elements in that object to the current object’s set.
Read now
Unlock full access