destroy

Prepares the DetailButton 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 DetailButton element from DOM.

Example

<div data-role="view" data-init="onInit">
  <ul data-role="listview">
     <li>Item 1<a data-role="detailbutton"></a></li>
     <li>Item 2<a data-role="detailbutton"></a></li>
  </ul>
</div>

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

function onInit() {
$(".km-listview")
  .find("[data-role='detailbutton']")
  .each(function(idx, item) {
    $(item).data("kendoMobileDetailButton").destroy(); //detach events
    $(item).remove(); //remove element from the DOM
  });
}
</script>
In this article