Sunday, 1 September 2013

convert an array to a list using jquery

convert an array to a list using jquery

got a challenge to convert a two dementional array to a html list. the
array is like var arr=[[1,"link1",3],[2,"link2",0],[3,"link3",2]]. the
structure of the nested array item is id, textOfLink, parent. parent 0
means top level, parent 3 means the item is under another list item with
id of 3. the target output will a list in html like
link2 link3 link1
please note the arr is not limited to 3 items, it is dynamic. anyidea how
to do it in jQuery?

No comments:

Post a Comment