I am trying to use use the following JSON data to create the following similar structure in a recursive inner function with not much luck, really need some help and so if an
Make two functions makeUL and makeLI. makeUL calls makeLI on each element, and makeLI calls makeUL if there's sub elements:
function makeUL(lst) {
...
$(lst).each(function() { html.push(makeLI(this)) });
...
return html.join("\n");
}
function makeLI(elem) {
...
if (elem.sub)
html.push('' + makeUL(elem.sub) + '');
...
return html.join("\n");
}
http://jsfiddle.net/BvDW3/
Needs to be adapted to your needs, but you got the idea.