The event is registered before the elements exist in the DOM
, which is why the function is not triggered.
(在元素存在于DOM
之前注册该事件,这就是为什么不触发该功能的原因。)
The solution is to define the code after your ajax
or use event delegation as below (解决方案是在ajax
之后定义代码或使用事件委托,如下所示)
$(document).ready(function() {
$(document).on("click", "#check tr td button", function() {
alert('here');
});
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…