Why am I getting .clear() is not a function while clearing a datatable?

datatable, jquery

Solution

example from the jsfiddle below, deleting all content from (on a paginated table!).

$("#delete").click(function() {
dataTable.fnClearTable();
dataTable.fnAddData([
    'new engine',
    'new browser',
    'new platform',
    'new version',
    'new css'
]);
});

you should use like `$('#table').dataTable().fnClearTable();` and aslo check js fiddle

jsfiddle

Problem

I'm getting the error below: getdata.js:96 Uncaught TypeError: $(...).dataTable(...).clear is not a function When I use the following code: ``` $("#dynamic-table").dataTable().clear(); ``` Although the function works fine and clears the datatable but I get an error in console

Original source