summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-FE/client/bower_components/jqTree/_entries/43_getnodebyhtmlelement.md
blob: 926f90a58ef32791b25436f1be6dea1e03ff03bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
---
title: getNodeByHtmlElement
name: functions-getnodebyhtmlelement
---

**function getNodeByHtmlElement(html_element);**

Get a tree node by an html element. The html element should be:

* The `li` element for the node
* Or, an element inside the `li`. For example the `span` for the title.

{% highlight js %}
var element = document.querySelector('#tree1 .jqtree-title');

var node = $('#tree1').tree('getNodeByHtmlElement', element);

console.log(node);
{% endhighlight %}

The element can also be a jquery element:

{% highlight js %}
var $element = $('#tree1 .jqtree-title');

var node = $('#tree1').tree('getNodeByHtmlElement', $element);

console.log(node);
{% endhighlight %}