If you were to label elements by some [tag] system, likely attached by the user, and you wanted to count the number of tags (defined by the number of classes the element has), how would you accomplish this?
This could be beneficial if you were to try to review all elements by number of tags. (This likely could be accomplished by other structures, but if you were to only reference the element tags in this way)
Jquery has .hasClass(), is there something like .classCount()
You could create it…
jsFiddle.
If you don’t have jQuery, you could use…
jsFiddle.
If you don’t have jQuery and have to support the older browsers, go with…
jsFiddle.