2021.1

Table Of Contents
Note that these styles use the list's ID, that was defined in the first line of code. For information
about style sheets, see "Styling templates with CSS files" on page738.
parent()
Returns the parent(s) of one or more HTML elements, which can be:
l The elements that match the selector of a script (see "results" on page1427).
l One element that matches the selector of a script that runs for "Each matched element"
(see "this" on page1345 and "Setting the scope of a script" on page874).
l The elements returned by a query in the template (see "query()" on page1299).
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
page1362).
To get an element's sibling element, you can use "prev()" on page1377 or "next()" on
page1370.
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
page1427). 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 page1427).
l One element that matches the selector of a script that runs for "Each matched element"
(see "this" on page1345 and "Setting the scope of a script" on page874).
l The elements returned by a query in the template (see "query()" on page1299).
See also: "append()" on page1353.
Page 1374