2019.2

Table Of Contents
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 page902.
text()
text() : String
Returns the text content of the first element in a result set.
Example
This script loads a snippet into a variable and retrieves an element from the snippet using query
() and text().
var mysnippet = loadhtml('snippets/text-root-wrapped.html');
var subject = query("#subject", mysnippet).text();
results.append("<p style='font-weight: bold;'>" + subject +
"</p>");
text(value)
Replaces the text content of each element in a result set by the supplied value.
Page 1325