2022.2

Table Of Contents
ThisscriptlooksupanelementwiththeID#salesrepandinsertsastringafterit.Thestringisauto-
maticallyenclosedinaspan.
query("#salesrep").after("Lorem Ipsum");
Matched element Matched element after script execution
<pid="salesrep">PeterParker</p> <pid="salesrep">PeterParker</p>
<span>LoremIpsum</span>
append()
InsertcontentattheendofoneormoreHTMLelements,whichcanbe:
l
Theelementsthatmatchtheselectorofascript(see"results"onpage1301).
l
Oneelementthatmatchestheselectorofascriptthatrunsfor"Eachmatchedelement"(see
"this"onpage1237and"Settingthescopeofascript"onpage813).
l
Theelementsreturnedbyaqueryinthetemplate(see"query()"onpage1197).
Seealso:"prepend()"onpage1262.
append(content)
InsertscontentasthelastelementattheendofoneormoreHTMLelements.Append()createsanew
resultset.
content
String,HTMLstringorresultsettoinsertaftertheelement(s).Incaseaplaintextstringisprovided,itis
automaticallywrappedina<span>elementtoavoidorphantextnodestoappearinthe<body>ele-
ment.
Examples
Thisscriptappendsaparagraphtotheresults(thesetofHTMLelementsthatmatchtheselectorof
thescript).
results.append("<p>Peter Parker</p>");
Page 1244