Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a treeview that should have items and sub items.
This should be my pattern like,
|111
|||222
|444
|||333
|555
|||666
.
.
.
.etc
So based on my above example, So when I click on '111', it should generate '222' under '111' as a sub item only once, which is applicable for '444' and '555'. My requirement is '111' is a folder and '222' is subfolder. So when I click on a folder, then it should generate the subfolders inside that folder. Please help how to do this

What I have tried:

HTML
<li id='click'>".$folderList[$ind]."</li>


Javascript
<script>
var handleAdd = function (event) {
    var $this = $(this);
    if ($this.children('ul').length > 0) {
        $('<li></li>').appendTo($this.children('ul'));
    } else {
        $('<ul><li></li></ul>').appendTo($this);
    }
    event.stopPropagation();
};
$(document).on('click', 'li', handleAdd);
</script>
Posted
Updated 23-Mar-17 20:42pm
v4
Comments
Karthik_Mahalingam 24-Mar-17 2:28am    
"which is applicable for '444' and '555'." ????
not clear!
User1454 24-Mar-17 2:32am    
Means on clicking '444' it should generate '333' and on clicking '555' it should generate '666'. Sorry if I didn;t explain it clearly.
Karthik_Mahalingam 24-Mar-17 3:02am    
Always use  Reply  button, to post Comments/query to the user, so that the user gets notified and responds to your text.
User1454 24-Mar-17 4:14am    
Yeah ! ok .. I didnt notice that ... thanks
Karthik_Mahalingam 24-Mar-17 3:02am    
how come 444 to 333 and 555 to 666 what is the logic behind

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900