Get element tag name and length with Jquery each

Viewed 1714

I'm trying to get info about all element tags and there frequency in the page, this is how I find the tag, very simple:

$('body *').each(function(){
var string = this.tagName;

But the length doesnt catch up:

var count =  $(this).length;

It gives me 1 while there are two divs, example: JsFiddle

I can solve this problem by removing the each function but I need it for the tagname. I have to use body * for my project so I can't refer directly to the divs.

2 Answers
Related