JSFiddle - React, Tailwind, and code Playground

by Wendy

HTML

<div id="an_id">
    <p class="abc">Text</p>
</div>
<div id="footer"></div>

JavaScript

var footer = $("#footer");
var newdiv = $("<div id='newdiv'></div>");
newdiv.insertAfter(footer);

var all = document.getElementsByTagName("*");
var the_classes = {};
var the_ids = {};
newdiv.append();
for (var i = 0, max = all.length; i < max; i++) {
    if (all[i].className !== '') {
        newdiv.append(all[i].className);
        the_classes[all[i].className] = 1;
    }
    if (all[i].id !== '') {
        the_ids[all[i].id] = 1;
    }
}
newdiv.append("<h3>Classes</h3>");

$.each(the_classes, function (key, element) {
    newdiv.append(key + '<br/>');
});
newdiv.append("<h3>IDs</h3>");

$.each(the_ids, function (key, element) {
    newdiv.append(key + '<br/>');
});