count - jQuery inside body tag only? -


is there way count children inside element using jqueru or javascript?

i tried several methods like:

var count = $(document.body).children().length  or  var count = 0; $(document.body).children().each(function(){    count +=1 }); 

and every single 1 counts elements outside of tag , scripts or styles!

so there way count elements inside body tag?

to number of elements inside body tag, try

var btags = document.body.getelementsbytagname("*"); var count = btags.length; 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -