2022.1

Table Of Contents
Selector Matched element Matched element after script
execution
#chapters <p id="chapters">
{{chapters}}</p>
<h1>Chapter 1</h1>
<p>Lorem ipsum...</p>
<h1>Chapter 2</h1>
<p>Loremipsum...</p>
<h1>Chapter 3</h1>
<p>Loremipsum...</p>
<h1>Chapter 4</h1>
<p>Loremipsum...</p>
addClass()
Adds the specified class(es) to one ore more HTML elements, which can be:
l The elements that match the selector of a script (see "results" on page1509).
l One element that matches the selector of a script that runs for "Each matched element"
(see "this" on page1425 and "Setting the scope of a script" on page924).
l The elements returned by a query in the template (see "query()" on page1379).
Adding a class has no effect if the class is already present.
addClass(classname)
Adds the specified class(es) to one or more HTML elements. This has no effect if the class is
already present.
classname
String, space separated list of class names.
Examples
This script adds a class name to a paragraph.
results.addClass("foo");
Page 1390