text
Gets or sets the text of a node in a TreeView.
Parameters
node jQuery|Element|String
The node of which the text is being retrieved or set.
newText String
Optional. When passed, sets the node text to the specified string
Returns
String
The text of a node.
Example
<div id="treeview"></div>
<script>
$("#treeview").kendoTreeView({
dataSource: [
{ text: "foo", items: [
{ text: "bar" }
] }
]
});
var treeview = $("#treeview").data("kendoTreeView");
var firstItem = treeview.element.find(".k-treeview-item:first");
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(treeview.text(firstItem)); // logs "foo"
treeview.text(".k-treeview-item:last", "qux"); // sets text to "qux"
</script>