2022.2

Table Of Contents
var salesrep = query("#salesrep");
salesrep.after("<p>Lorem ipsum</p>");
salesrep.css("color","red");
Thefollowingscriptinsertsaparagraphaftertheelementsintheresults(thesetofHTMLelementsthat
matchtheselectorofthescript).
results.after("<p>Lorem Ipsum</p>");
Matched element Matched element after script execution
<pid="salesrep">PeterParker</p> <pid="salesrep">PeterParker</p>
<p>Loremipsum</p>
Thisscriptlooksforthestring"Lorem"intheresults(thesetofHTMLelementsthatmatchtheselector
ofthescript)andinsertsthestring"ipsum"rightafterthattext.Thestringisautomaticallyenclosedina
span.
results.find("Lorem ").after("ipsum");
Matched element Matched element after script execution
<p>Loremdolorsitamet,consecteturadipiscingelit.</p> <p>Lorem<span>ipsum</span>dolorsitamet,consecteturadipiscingelit.</p>
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>
Page 752