Help needet with multie level unordered list
Hi,
I am making my first jquery plugin ( advance sitemap with Drag,Drop, Sort ) for my own cms system.
Plugin is 95% finished but with one bug which makes me crazy. My plugin supports how many levels can user add pages (example 3 level menu, 5 level menu ...).
Problem:
I am dragging element(ui.draggable) with below code and appending to other LI when drop. I can count parents (levels ul li) where i drop.
I can not count how many levels (ul li) has draggable element ( ui.draggable ), i tryed everything i know about jquery, please help me out.
ui.draggable:
- <li>
- <ul>
- <li>
- ... MORE LEVELS
- </li>
- <li></li>
- ... MORE LEVELS
- </ul>
- </li>
I count parent levels with this code ( Parent levels must be counted where i drop )
:
- var ParentCount = $(li).parents('li#page > ul').length;
I tryed counting max levels with:
- ui.draggable.children('li > ul')
ui.draggable.find('li > ul')
So i need help with:
Nummber of max level ( UL LI ) in ui.draggable. Please help me out i wanna finish this plugin 100%.
Greatings from Slovenia and tnx in advance.