I'm having the following Smary template (it's a file-tree, files are populated separately and then list_html
is assigned to geberated file tree hrml)
<script>
$("#directory-list-root").on("click", "div.content", function() {
$("div.selected", "#directory-list-root").removeClass("selected");
$(this).addClass("selected");
// Check if directory is expanded
var node = $(this).parent("li.directory");
if (node.hasClass("expanded")) {
node.removeClass("expanded");
$(this).siblings("ul.container").hide();
} else {
node.addClass("expanded");
$(this).siblings("ul.container").show();
}
} );
</script>
<div id="directory-list-root">
<ul class="container" style="padding:5px" id="tree">
{$list_html}
</ul>
</div>
In the code it's used twice (in jquery-ui dialogs that are shown one after another). And the problem is that for the first time handling function is OK, but for the second click-handler is not working. If I remove tree from the first dialog then handlers in the second are assigned.
Do you know how that can be fixed?
Thank you in advance!
PS. I'm running Smarty 3.1.13
if that matters.