2020.1

Table Of Contents
(see "this" on page834 and "Setting the scope of a script" on page383).
l The elements returned by a query in the template (see "query()" on page792).
To hide elements (again), use the function "hide()" on page857.
These functions are used by the Conditional Script Wizard, as you can see when you open a
Conditional Script and click the Expand button; see "Showing content conditionally" on
page345.
Example
This script hides or shows the elements matched by the selector of the script (which are stored
in the results object), depending on the value of the data field Country in the current record.
if (record.fields["Country"] == "CANADA") {
results.show();
} else {
results.hide();
}
tagName()
Returns the HTML tag name of one HTML element in uppercase (e.g. H1, P, ARTICLE).
Example
This Post Pagination Script finds level 1 and 2 headings in all Print sections and stores their
page number, text and HTML tag name.
merge.context.query("h1, h2").each(function() {
var pageNo = this.info().pageNo;
var text = this.text();
var level = this.tagName();
});
This code is used in a script that inserts a table of contents. For the full script and explanation
see "Creating a Table Of Contents" on page429.
Page 832