2020.2

Table Of Contents
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 page869.
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 page855, " Adding a
Control Script" on page891 or "Adding a Post Pagination Script" on page907), 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.
Warning
When you change an expanded text script and save it, it becomes impossible to
edit the script using the Script Wizard again.
2.
Write the script. Click Apply from time to time to see if the script works as expected. This
will be visible on the Preview tab in the main workspace.
Syntax rules
Every script in the Designer must follow JavaScript syntax rules. For example, each statement
should end with ; and the keywords that can be used, such as var to declare a variable, are
JavaScript keywords. There are countless tutorials available on the Internet to familiarize
Page 857