destroy

Prepares the widget for safe removal from the DOM. Detaches all event handlers and removes jQuery.data attributes to avoid memory leaks. Calls destroy method of any child Kendo widgets.

This method does not remove the widget element from the DOM.

Example

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    dataSource: [{
      "name" : "Telerik",
      "items": [
        {"name": "Kendo"},
        {"name": "Icenium"}
      ]
    }],
    template: "#= item.name #"
  });

  var diagram = $("#diagram").data("kendoDiagram");
  diagram.destroy();

</script>
In this article