How do I get leaf nodes in jstree to open their hyperlink when clicked when using jstree ui?
for new versions;
$("#demo2").jstree().bind("select_node.jstree", function (e, data) {
var href = data.node.a_attr.href;
document.location.href = href;
});
I know this post is kinda old, but here what I did to make this work :
html:
<div id="entryPointTree">
<ul>
<li>Produits des mains
<ul>
<li><a href="http://www.google.ca" class="jstree-clicked">Lien 1</a></li>
<li>item 2</li>
</ul>
</li>
<li>Produits des pieds</li>
</ul>
</div>
js:
$(document).ready(function() {
$("#entryPointTree").jstree({ "plugins" : ["themes","html_data","ui"] });
$("#entryPointTree li").on("click", "a",
function() {
document.location.href = this;
}
);
});
My solution for v3.3.4, it works fine!
tree.jstree().on("click", ".jstree-anchor", function() {
document.location.href = this.href;
});