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.
Copy
                                                    
                                                
                                                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.