2021.2

Table Of Contents
n HTML elements with a specific CSS class (eg. green). In the Script Wizard,
click Selector and type the class name in the Selector field, preceded by a
dot: .green.
n An HTML element with a specific ID (eg. intro). In the Script Wizard, click
Selector and type the ID in the Selector field, preceded by #: #intro.
In an HTML file, each ID should be unique. This means that a particular ID can
be used only once in each section.
n Etcetera. See https://www.w3schools.com/cssref/css_selectors.asp for more
selectors and combinations of selectors; also see "Selectors in Connect" on
page898 for selectors that can only be used in Connect.
l A selector and text. This is text inside an HTML element (or several HTML
elements) with a specific HTML tag, CSS class or ID. In the Script Wizard, click
Selector and Text.
Tip
When output speed matters, choose selector or selector and text. Searching text
is a rather lengthy operation, compared to searching for HTML elements and/or
CSS selectors. See also: "Optimizing scripts" on page892.
Quick-start a script for a specific ID or class
There is a shorter route to create a script for an element with a specific ID or class:
1. In the template, click the element for which you want to create a script.
2. On the Attributes pane at the top right, type an ID or class.
3. Click the label to the left of the ID or Class input field (ID or Class) to make a new script
with that ID or class as selector.
Writing a script
1. Create a new script (see: "Creating a new Standard Script" on the previous page, "
Adding a Control Script" on page914 or "Adding a Post Pagination Script" on page930),
or double-click an existing script in the Scripts pane on the bottom left.
If the script was made with a Script Wizard, you have to click the Expand button before
you can start writing code. This will change the Script Wizard into an editor window.
Page 880