.DataTable is not a function
.DataTable is not a function
I have the following table in my HTML page:
<table id="courseTable">
<thead> ...
</table>
At the bottom of the html, I have 2 script tags, First is the CDN import as follows:
Then I have the script area where my javascript is located
$(document).ready(function() { $('#courseTable').DataTable(); // ERROR LINE });Please see image for correct script code. The editor is not showing it correctly.
When the page loads, I get an error stating that .DataTable is not a function
I've tried installing using NuGet, copying the code from CDN into my own file and also in this version referencing the CDN. Nothing seems to work. I would really like to use this library, but can't seem to even get started.
Answers
Are you referencing jQuery in your HTML?
DataTables' installation requirements are pretty clear.
https://datatables.net/manual/installation
Yes, its either that DataTables is not installed or you are loading jQuery multiple times. Loading it more than once will cause the previously loaded version of jQuery to be overwritten.
Allan