How can I destroy a datatable

datatable, datatables, html, javascript

Solution

For latest version of datatables use:

$('#example').DataTable().destroy();

Refer to this for more: https://datatables.net/reference/api/destroy%28%29

For older versions use as stated by Hobo Sapiens:

$('#example').DataTable().fnDestroy();

Problem

I have datatable and table have ID example. Now I need to destroy datatable and I write: ``` $('#example').dataTable().fnDestroy(); ``` but I get: Uncaught TypeError: Cannot read property 'style' of undefined also this I get in console log: What is the problem here? Why can't I destroy the datatable? How to solve this?

Original source

Related problems