Apply Datatable to a Dynamically created Table
Apply Datatable to a Dynamically created Table
tockz
Posts: 2Questions: 1Answers: 0
Hi,
I'm trying to apply DataTables to dynamically created tables.
The id's of the tables all end in .costTable,
for example
SolutionOptionViewModels[347b49b5-0ea4-4404-aebe-8197bfdfced0].costTable
I've tried the following code
$(document).ready(function () {
$("[id$='.costTable']").each(function (i, el) {
$(el.id).DataTable();
});
});
However it doesn't seem to work and I don't appear to get any errors.
Any help would be great.
Thanks
This discussion has been closed.
Answers
Nevermind,
I just had to change it to
$(el).DataTable();