2022.1

Table Of Contents
}
results.replaceWith(chapters);
show()
Shows one or 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).
To hide elements (again), use the function "hide()" on page1449.
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
page856.
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();
});
Page 1423