2021.2

Table Of Contents
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).
In HTML, a parent is an element that contains another element.
To get an ancestor that matches a particular selector, use closest() (see "closest()" on
page1382).
To get an element's sibling element, you can use "prev()" on page1397 or "next()" on
page1390.
Example
Assume that there are three paragraphs in a Box and that one of those paragraphs matches the
selector of this script. The paragraph is stored in the results object (see "results" on
page1448). The following script retrieves the Box (which is the parent of the paragraph) using
results.parent(), and then changes its background color to red.
results.parent().css('background-color' , 'red');
prepend()
Insert contentat the beginning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: "append()" on page1373.
prepend(content)
Insert contentas the first element toeach element in the set of HTML elements that match the
selector of the script or of another query in the template (see "query()" on page1319).Append
creates a new result set.
content
Page 1394