I use the DataTables plugin for jQuery, but keep getting the following error when I try to use the fnDestroy method:
Undefined
I tried using all of the following options:
1)
$('#data').dataTable().fnDestroy();
2)
var dt = $('#data').dataTable(); dt.fnDestroy();
3)
var data = document.getElementById('data'); data.fnDestroy();
The 'data' object exists - HTML looks like this:
<div class="resultset"> <table class="display" id="data"> <tbody> </tbody> </table> </div>
The DataTable is built with Javascript (not shown here), but the underlying object is hard-coded.
The API documentation shows that the second method should work:
$(document).ready(function() {
EDIT
The DataTable works great and works well. The problem occurs when I try to execute this function.
source share