2019.2

Table Of Contents
'.html'));
}
results.replaceWith(chapters);
show()
Shows the elements in a set. To hide elements (again), use the function "hide()" on page830.
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
page348.
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 element in a set of HTML elements, 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 page428.
Page 840