javascript - Is there a JS/jQuery Fully Recursive child node count function? -


folks,

let's have following situation:

<div class="outer">     <div>         <span>              <ul>                  <div> </div>                  <div> </div>              </ul>          </span>      </div>   </div> 

how find total number of elements inside div.outer? $('div.outer').children().size() or length returns 1 (i'm looking, in case, 5) there shortcut or function find total element count using js/jquery or should write function issue? tia.

var totaldescendants = $('div.outer *').length;

and done.


var totaldescendants = $('div.outer').find('*').length;

would work.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -