destroy

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

Important: This method does not remove the Collapsible element from DOM.

Example

<div data-role="view">
    <div id="collapsible" data-role="collapsible" data-collapsed="false">
        <h2>Header</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
    </div>
  <a data-role="button" data-click="removeBtn">Remove button</a>
</div>

<script>
  var app = new kendo.mobile.Application();

  function removeBtn() {
    $("#collapsible").data("kendoMobileCollapsible").destroy(); //detach events
    $("#collapsible").remove();
  }
</script>
In this article