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


I would like to take a basic element inside to detect all the elements and still check whether the child's child element And they also know

for example:

   

I want to know the list of all the IDs inside # and check each child if she has a child and as long as I do not have a complete list of all the elements Keep it

I want this array in this array in an array type

  array ("body" => gt; {"first" = "gtc:" second1 " , "Second2" ...........});  

Try it out:

  $ ("# First <">  $ (" #before "). 

Add some recurrence

  function recursion (elem, arr) {var id = $ (elem ) .attr ('id'); if (id) {var children = arr [id] = {}; $ (Elem). Child () (function () {recursion (this, children)});} } Element; {}; recursive ($ ("# first"), element); Console.log (JSON.stringify (element));  

and you

< "{2}": {"fourth 1": {}, "fourth 2": {"second"}: {"second1": {}, "second2": {"third1": {}, "third 2": {}}, "Third 3": {}}, "second 3": {}, "second 4": {}}}


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -