I am using jQuery DataTables 1.9.4. On trying to use the datatable module I am getting the above error. Going through SO, I have seen a lot of people advising to use the uppercase DataTable({}) instead of the lowercase dataTable({}), but still get the error.
var table = $("#example1").DataTable();
$('#example1 tbody').on('click', 'tr', function () {
var data = table.row(this).data();
});
Note this is an ASP.NET MVC Project
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>@Html.DisplayNameFor(model => model.FirstName)</th>
<th>@Html.DisplayNameFor(model => model.Surname)</th>
<th>@Html.DisplayNameFor(model => model.MiddleName)</th>
<th>@Html.DisplayNameFor(model => model.DateOfBirth)</th>
<th>@Html.DisplayNameFor(model => model.Department)</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>@Html.DisplayFor(modelItem => item.FirstName)</td>
<td>@Html.DisplayFor(modelItem => item.Surname)</td>
<td>@Html.DisplayFor(modelItem => item.MiddleName)</td>
<td>@Html.DisplayFor(modelItem => item.DateOfBirth)</td>
<td>@Html.DisplayFor(modelItem => item.Department)</td>
</tr>
}
</tbody>
</table>