arrays - How to create a Javascript Arrayfrom dom element -


i have list-view

<ul class="list-view">     <li><span>root</span>         <ul>             <li>child1                     <ul><li>chlid11</li></ul>             </li>             <li>child2                     <ul>                         <li>chlid21</li>                         <li>chlid22</li>                     </ul>             </li>             <li>child3                     <ul>                         <li>chlid31</li>                     </ul>             </li>         </ul>     </li>         </ul> 

i asked in interview write json representation of above html element , print true if searched child exsist in tha json

for example:if enter child21 answer should true

please me out new json

thanks

above format of dom xml. xml json parser should think.

here specific library dom json: https://en.wikipedia.org/wiki/jsonml


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -