[SOLVED] TypeError: $(…).DataTable is not a function

Table of Contents


I am trying to work with jQuery’s Datatable JS for my project from this link.

I downloaded the complete library from the same source. All the examples given in the package seem to work fine, but when I try to incorporate them in my WebForms,the CSS,JS do not work at all.

Here is what I have done :

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link href="css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
    <form id="form1" runat="server">
        <table id="myTable" class="display" cellspacing="0" width="100%">
                    <th>Start date</th>
                    <th>Start date</th>
               <!-- table body -->
    <script src="js/jquery.dataTables.js" type="text/javascript"></script>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {

My file structure for the JS and CSS in my Solution looks as follows :

File structure of JS and CSS in solution

I have added all the necessary JS and CSS references as shown in the manual. Still the rendering isn’t as expected. There is no CSS and even the JS doesn’t work.

Also in the console i get the following errors:

ReferenceError: jQuery is not defined
TypeError: $(...).DataTable is not a function

I have still not bound any dynamic data here (like within a repeater or so) still it is not working.

Can someone please guide me in the right direction for this problem ?



There could be multiple reasons for this error.

  • jQuery DataTables library is missing.
  • jQuery library is loaded after jQuery DataTables.
  • Multiple versions of jQuery library is loaded.


Include only one version of jQuery library version 1.7 or newer before jQuery DataTables.

For example:

<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jquery.dataTables.min.js" type="text/javascript"></script>

See jQuery DataTables: Common JavaScript console errors for more information on this and other common console errors.

Answered By – Gyrocode.com

Answer Checked By – Timothy Miller (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *