[英]Action to element with same id
First of all, ID should be unique. 首先,ID应该是唯一的。 So, use class instead of id.
因此,请使用类而不是id。
Next thing you should bind the jquery to use the method: 接下来,您应该绑定jquery以使用该方法:
$(this).dataTable(); // instead of this, use $(this)
$(document).ready(function(){
$('.example').each(function(){
$(this).dataTable();
});
});
Id
s can't be same ,they must be unique
Id
不能相同,必须unique
you should use class
instead of id
您应该使用
class
而不是id
so 所以
if you give class="example"
for all your required elements then you could use 如果为所有必需的元素都提供
class="example"
,则可以使用
$(document).ready(function(){
$('.example').each(function(){
$(this).dataTable();
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.