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-item:first");
console.log(treeview.text(firstItem)); // logs "foo"

treeview.text(".k-item:last", "qux"); // sets text to "qux"
</script>
In this article
Not finding the help you need? Improve this article