TypeError: appendTo is not a function
TypeError: appendTo is not a function
nayton
Posts: 16Questions: 6Answers: 0
**Error messages shown:
jQuery.Deferred exception: appendTo is not a function TypeError: appendTo is not a function:
Description of problem: when I load the page, in the chorme developer tool console it says: appendTo is not a function TypeError: appendTo is not a function
and points the error to line 8: appendTo($(column.footer()).empty())
Can someone help me ?
<script>
$(document).ready(function() {
$('#example').DataTable({
initComplete: function() {
this.api().columns().every(function() {
var column = this;
var select = $('<select><option value=""></option></select>')
appendTo($(column.footer()).empty())
.on('change', function() {
var val = $.fn.dataTable.util.escapeRegex(
$(this).val()
);
column
.search(val ? '^' + val + '$' : '', true, false)
.draw();
});
column.data().unique().sort().each(function(d, j) {
select.append('<option value="' + d + '">' + d + '</option>')
});
});
},
"language": {
"lengthMenu": "Exibindo _MENU_ registros por página",
"zeroRecords": "Nenhum registro encontrado",
"info": "Exibindo página _PAGE_ de _PAGES_",
"infoEmpty": "Nenhum registro disponível",
"infoFiltered": "(filtrado de _MAX_ registros no total)"
}
});
});
</script>
This question has an accepted answers - jump to answer
Answers
Looks like you are missing a period. Line 8 should look like this:
Kevin
It was exactly that. Thanks a lot for the help.