Answer the question
In order to leave comments, you need to log in
How to convert nested html lists to php array?
Good evening.
There is an html list in the format
<ul>
<li>Item 1
<ul>
<li>item 1.1</li>
<li>item 1.2
<ul>
<li>item 1.2.1</li>
<li>item 1.2.2</li>
<li>item 1.2.3
<ul>
<li>item 1.2.3.1</li>
</ul>
</li>
</ul>
</li>
<li>item 1.3</li>
</ul>
</li>
<li>Item 2</li>
<li>Item 3
<ul>
<li>Item 3.1</li>
</ul>
</li>
</ul>
Answer the question
In order to leave comments, you need to log in
On the client, this structure is a DOM tree that can be perfectly parsed recursively. To understand what is what, which node is nested, which is not, this article will help you: www.w3schools.com/jsref/prop_node_nodetype.asp
Well, this is also:
www.w3schools.com/jsref/prop_node_nodename.asp
www.w3schools .com/jsref/prop_node_nodevalue.asp
www.w3schools.com/jsref/prop_node_childnodes.asp
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question