.add()

Add elements to the set of matched elements.

HTML:

<p>Hello</p><span>Hello Again</span>

JQUERY:

$(“div”).css(“border”, “2px solid red”)
.add(“p”)
.css(“background”, “yellow”);

This JQ will,

Step : 1  find the div and apply the red to the border
Step : 2  Then add p element to the end of the div and apply background as yellow

OUTPUT :