我正在寻找一种方法来了解页面中的表格是否为 dataTable?有没有简单的方法可以找到它?或者如果我可以获得 dataTable 的所有对象。
最佳答案
DataTables 插件中有一个静态方法,因此您可以验证为:
$('table').each(function() {
// this method accepts the DOM node (table element) as parameter
if ( $.fn.dataTable.fnIsDataTable(this) ) {
// do your thing to the table
}
});
关于javascript - 有没有办法发现page中的某个table是一个dataTable对象呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8934320/