.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 :