Edit this page

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>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy