Hello, Please help me. I found a bug. Describe in detail... I enter a search word and get from database rows - links with parameter kodbpod unit.
<table><tr><td><span><a href="" onclick="javascript:getTreeView (7);return false;">Отдел сопровождения ПЦ</a></span></td></tr> <tr><td><span><a href="" onclick="javascript:getTreeView(11);return false;">Отдел разработки банковских систем</a></span></td></tr></ table> http://pastie.org/725120 (see this). After I click on the link and call the function getTreeView(kodbpod) that builds a tree units by jquery.treeview.js ( http://pastie.org/725130 ) and jquery.treeview.async.js ( http://pastie.org/725128 ) When I click first link - a tree is works normal, branches opened and closed by pressing the branches. But when you're clicking the same link a second time, the tree is built, but the branch is not open and not closed. I looked up what the code is formed at the output in the first case, when the tree is working normal. <ul class="treeview" id="async"><li class="open collapsable lastCollapsable" id="1"><div title="tree_div" class="hitarea open- hitarea collapsable-hitarea lastCollapsable-hitarea"></div><span class="">Блок ИТ</span><ul><li id=""><span><a class="" href="">Бочарников Игорь Викторович И.О. Управляющего директора 1075, 1202</a></span></li><li class="open collapsable lastCollapsable" id="2"><div title="tree_div" class="hitarea open-hitarea collapsable- hitarea lastCollapsable-hitarea"></div><span class="">Департамент проектирования информационных систем</span><ul style="display: block;"><li class="open collapsable lastCollapsable" id="3"><div title="tree_div" class="hitarea open-hitarea collapsable-hitarea lastCollapsable-hitarea"></div><span class="">Управление по разработке транзакционных систем</span><ul><li class="last" id="7"><span>Отдел сопровождения ПЦ</span></li></ul></li></ul></li></ul></li></ul> And then look what the code is formed at the output in the second case, when the tree is built, but does not work. <ul class="treeview" id="async"><li class="open collapsable lastCollapsable" id="1"><div title="tree_div" class="hitarea open- hitarea collapsable-hitarea lastCollapsable-hitarea"></div><div title="tree_div" class="hitarea open-hitarea collapsable-hitarea lastCollapsable-hitarea"></div><span class="">Блок ИТ</span><ul><li id=""><span><a class="" href="">Бочарников Игорь Викторович И.О. Управляющего директора 1075, 1202</a></span></li><li class="open collapsable lastCollapsable" id="2"><div title="tree_div" class="hitarea open-hitarea collapsable-hitarea lastCollapsable- hitarea"></div><div title="tree_div" class="hitarea open-hitarea collapsable-hitarea lastCollapsable-hitarea"></div><span class="">Департамент проектирования информационных систем</span><ul style="display: block;"><li class="open collapsable lastCollapsable" id="3"><div title="tree_div" class="hitarea open-hitarea collapsable- hitarea lastCollapsable-hitarea"></div><div title="tree_div" class="hitarea open-hitarea collapsable-hitarea lastCollapsable- hitarea"></div><span class="">Управление по разработке транзакционных систем</span><ul><li class="last" id="7"><span>Отдел сопровождения ПЦ</ span></li></ul></li></ul></li></ul></li></ul> You see ? Duplicate DIV in second case. And so every time: at 1,3,5,7 ... click on the link tree is built and works at 2,4,6,8 ... click on the same link tree is built, but does not work. I think the bug here somewhere... this.prepend("<div title=\"tree_div\" class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() { var classes = ""; $.each($(this).parent().attr("class").split(" "), function() { classes += this + "-hitarea "; }); $(this).addClass( classes ); }); but I don't know how to fix it... How to fix this? HELP PLEASE.