2019.2

Table Of Contents
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 page902.
hasClass()
hasClass(classname) : Boolean
Returns true if the first element in this result set has the specified class.
classname
String containing one class name.
Example
This script checks if the first of the results (the set of elements matching the selector of the
script) has the class 'green'. If so, it colors the text of all the elements in the results green.
Page 1313