I want to check if a table element with say, id=\"datatable\" is datatables-initialized. Something like this:
if ($(\'#datatable\').dataTable().initialized) {
After you've called .dataTable() does it do anything to the table that makes it identifiable? i.e. does it add a new class "initialised" or something like that? If so, you could just loop through the items like so:
$('.datatable').each(
function(index, element) {
var _table = $(element);
if (_table.hasClass('initialised')) {
// Do stuff
} else {
// Do stuff
}
}
);
Apologies if this isn't what you mean. It's not clear in your question what "dataTable()" actually does.