Reduce the Number of DOM Elements

A handy way to know how many DOM Elements you have on your page is doing the following:

document.getElementsByTagName('*').length  

For example, if you do that in the console of my blog you will find an output something like 144

That is more than fair enough. Because is not the same loop through 144 or 2000 DOM elements on the page when you want to add something.

If that is your case, check if something can be improved.

That's all folks!

Victor Velazquez

Coder, Musician, Startups, Passionate Dancer & Life Lover. Software Engineer at MagmaLabs, Co-founder of Web Dev Talks, Co-founder of Voltaire, Co-founder of Paqkit, Ex-co-founder of Zaznova.

Subscribe to The zazvick's blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!