div
s, and all the paragraphs inside of them, and give them both class names. Notice the div
doesn't have the yellow background color since it didn't use .andSelf()
. p").addClass("border");
+$("div.before-andself").find("p").addClass("background");
+$("div.after-andself").find("p").andSelf().addClass("background");
]]>
Before andSelf()
First Paragraph
Second Paragraph
-After andSelf()
First Paragraph
+Second Paragraph
+