[Solved] How to get only all HTML tags to list from string using javascript or jquery? [closed]


Something like that:

var tagList = {};
var tag;
document.querySelectorAll('*').forEach(function(node) {
  tag = node.tagName.toLowerCase();
  if (!tagList[tag]) {
    tagList[tag] = 1;
  } else {
    tagList[tag]++;
  }
});
tagList; // object, where key - html tag, and value – tag count per html document

Enjoy!

solved How to get only all HTML tags to list from string using javascript or jquery? [closed]