2021.2

Table Of Contents
Matched element Matched element after script execution
<p>Lorem dolor sit amet,
consectetur adipiscing elit.</p>
<p>Lorem<span>ipsum</span>dolor sit amet,
consectetur adipiscing elit.</p>
This script looks up an element with the ID #salesrep and inserts a string after it. The string is
automatically enclosed in a span.
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()
Insert contentat the end of one or more HTML elements, which can be:
l The elements that match the selector of a script (see "results" on page1448).
l One element that matches the selector of a script that runs for "Each matched element"
(see "this" on page1364 and "Setting the scope of a script" on page883).
l The elements returned by a query in the template (see "query()" on page1319).
See also: "prepend()" on page1394.
append(content)
Inserts content as the last element at the end of one or more HTML elements. Append() creates
a new result set.
content
String, HTML string or result set to insert after the element(s). In case a plain text string is
provided, it is automatically wrapped in a <span> element to avoid orphan text nodes to
appear in the <body> element.
Page 1373