destroy

Destroys the widget.

To run the below example, open it in Dojo

Example

<div id="example">
    <div class="box">
            <ul class="options">
                <li>
                    <button class="k-button" id="destroyBtn" type="button">Destroy the widget</button>
                </li>
            </ul>
    </div>
    <div id="pdfViewer">
    </div>
</div>

<script type="module">
    $(document).ready(function () {

        var pdfViewer = $("#pdfViewer").kendoPDFViewer({
            pdfjsProcessing: {
                file: "https://demos.telerik.com/kendo-ui/content/web/pdfViewer/sample.pdf"
            },
            width: "100%",
            height: 700
        }).data("kendoPDFViewer");

        $("#destroyBtn").click(function () {
          console.log('--- Before Destroy ---')
          console.log($("#pdfViewer").data("kendoPDFViewer"))
          $("#pdfViewer").data("kendoPDFViewer").destroy();
          console.log('--- After Destroy ---')
          console.log($("#pdfViewer").data("kendoPDFViewer"))

          // The destroy() method will destroy the PDFViewer widget. To remove the rendered component remove or empty the element from      which the widget has been initialized
          //$("#pdfViewer").remove()
        });
    });
</script>
In this article