Is there a way to detect elements inside a parent element?

Posted by Starx on Stack Overflow See other posts from Stack Overflow or by Starx
Published on 2010-06-14T08:33:49Z Indexed on 2010/06/14 8:42 UTC
Read the original article Hit count: 115

Filed under:
|

I would like to detect all the elements insides a parent element and still check if the child has child elements and detect them also.

For Example:

<div id="first">
     <div id='second1'></div>
     <div id='second2'>
          <div id='third1'></div>
          <div id='third2'>
               <div id='fourth1'></div>
               <div id='fourth2'></div>
          </div>
          <div id='third3'></div>
     </div>
     <div id='second3'></div>
     <div id='second4'></div>
</div>

I want to know the list of all the id inside the #first and check each child if it has its child and keep this on going until I have complete list of all element.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selector