Edit in JSFiddle

// Get HTML elements
html_elements = "h1,h2,h3";
//html_objects = jQuery(html_elements);

html_objects = jQuery("*");

// Add tag, class, and id information for each HTML element
html_objects.each(function () {
    tag = "Tag: " + jQuery(this).prop('tagName') + "<br>";
    classes = (jQuery(this).attr('class')) ? "Classes: " + jQuery(this).attr('class') + "<br>" : "";
    ids = (jQuery(this).attr('id')) ? "IDs: " + jQuery(this).attr('id') + "<br>" : "";
    tag_info = tag + classes + ids;
    jQuery(this).attr("title", tag_info);
});

// Add jQueryUI's tooltip widget
jQuery(document).tooltip({
    content: function () {
        return $(this).prop('title');
    }
});
<h1 class="h1">Primary Heading 1</h1>


<h2 class="h2">Secondary Heading 1</h2>


<h3 id="h3">Tertiary Heading 1</h3>


<h1>Primary Heading 2</h1>


<h2>Secondary Heading 2</h2>


<h3>Tertiary Heading 3</h3>


<h1>Primary Heading 3</h1>


<h2>Secondary Heading 3</h2>


<h3>Tertiary Heading 3</h3>
.ui-tooltip-content {
    font-family:"Lucida Console", Monaco, Courier, monospace;
    font-size: .7em;
}