2019.1

Table Of Contents
textToFind
A String that contains the search text.
Example
The following piece of code loads a snippet, then looks for placeholders using find(), and
replaces them with a text.
var mysnippet = loadhtml('snippets/snippet.html');
mysnippet.find('@var1@').text('OL Connect 1');
mysnippet.find('@var2@').html('<i>OL Connect 2</i>').css('text-
decoration','underline');
results.replaceWith(mysnippet);
get(index)
Returns the element found at the supplied index in a set of HTMLelements.
index
Place of the element in the result set. The index starts counting at zero.
Example
This Post Pagination Script copies the page numbers of level 1 and 2 headings in all Print
sections to the corresponding entry in a table of contents.
var $numbers = query('.number');
merge.context.query("h1, h2").each(function( index ) {
var pageNo = this.info().pageNo;
var entry = $numbers.get( index );
if( entry ) {
entry.text( pageNo );
}
});
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 page845.
hasClass()
hasClass(classname) : Boolean
Returns true if the first element in this result set has the specified class.
Page 1243