Uncaught TypeError: Cannot read property 'className' of undefined Uncaught TypeError: Cannot read property 'className' of undefined google-chrome google-chrome

Uncaught TypeError: Cannot read property 'className' of undefined


The other answer put me on the right track.

More succinctly, the error was that the table I was creating was incorrect.

My header columns (inside a thead of course), did not match up with my row columns (inside the tbody)

In my situation, I had too many columns inside the header.


Another possible cause is if you list more columns in the "aoColumnDefs" attribute than there are "td" elements in the table.

var yourTable = $('#product-search-results-table').dataTable({    // If you only have three columns in the HTML table, then this line will cause an error, because it lists four columns in "aoColumnDefs".    "aoColumnDefs": [{ "bSortable": false, "aTargets": [0, 1, 2, 3] }]});


Datatables requires that your html table is perfect. I found that I got this error when I did not have an equal amount of <th> and <td>. Make sure you do not have an extra header.