title: How to use DataTables fnDestroy method
body: <p>I am using the DataTables plugin for jQuery but keep getting the following error when I attempt to use the <a href="http://datatables.net/api" rel="noreferrer">fnDestroy</a> method:</p>
  
  <pre><code>Undefined
  </code></pre>
  
  <p>I have tried using all of the following variants:</p>
  
  <p>1)</p>
  
  <pre><code> $('#data').dataTable().fnDestroy();
  </code></pre>
  
  <p>2)          </p>
  
  <pre><code>var dt = $('#data').dataTable();
  dt.fnDestroy();
  </code></pre>
  
  <p>3)          </p>
  
  <pre><code>var data = document.getElementById('data');
  data.fnDestroy();
  </code></pre>
  
  <p>The 'data' object exists - The HTML is as follows:</p>
  
  <pre><code>&lt;div class="resultset"&gt;
       &lt;table class="display" id="data"&gt;              
           &lt;tbody&gt;
  
           &lt;/tbody&gt;
        &lt;/table&gt;  
  &lt;/div&gt;
  </code></pre>
  
  <p>The DataTable is built with Javascript (not shown here), but the base object is hard-coded.</p>
  
  <p>The API documentation shows that the second method should work:</p>
  
  <pre><code>$(document).ready(function() {
    // This example is fairly pointless in reality, but shows how fnDestroy can be used
    var oTable = $('#example').dataTable();
    oTable.fnDestroy();
  } );
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>The DataTable displays fine and otherwise works well.  The issue arises when I attempt to execute this function.</p>