如果使用 bootstrap-table 分页/搜索,则不会触发按钮单击

Button click not triggered if using bootstrap-table pagination / search

我正在使用文智信bootstrap-table,当我第一次加载页面时触发了按钮点击,但是在通过table分页后(使用bootstrap-table 功能,不再触发点击。

示例代码位于:https://jsfiddle.net/eitanmg/gsxb8645/9/

如何在使用 bootstrap-table 搜索/分页功能的同时触发我的按钮点击?

$(document).ready(function () {
    $(document).on("click",".done_status",function () {

    alert("hello!");

    });
});

您需要在按钮上绑定点击事件,这样它才能被DOM检测到。

这是一个fiddle

我在 jsfiddle 编辑了你的代码,现在可以通过以下编辑工作。

$("table").on('click', '.done_status',function () {

    alert("hello!");

}); 

您可以进行以下操作:

$(document).ready(function () {
    $("table").on('click', '.done_status', function () {
        alert("hello!");
      });
 });