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

时间:2018-04-09 11:59:08

标签: javascript jquery bootstrap-table

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

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

如何使用bootstrap-table搜索/分页功能触发按键点击?

3 个答案:

答案 0 :(得分:2)

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

    alert("hello!");

    });
});

您需要在按钮上绑定click事件,以便DOM可以检测到它。

这是fiddle

答案 1 :(得分:0)

我在jsfiddle编辑了你的代码,现在可以使用以下编辑。

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

    alert("hello!");

}); 

答案 2 :(得分:0)

您可以执行以下操作:

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