【问题标题】:jQuery cannot catch the DataTable button class in LaraveljQuery 无法捕获 Laravel 中的 DataTable 按钮类
【发布时间】:2018-07-10 04:06:57
【问题描述】:

td中的按钮是从DataTable Ajax返回的数据:

<button type="button" class="btn btn-default downpraise " data-toggle="tooltip"  data-placement="top" title="downbutton" name="downtest">
      <i class="far fa-thumbs-down">data</i>
</button>

我的功能是:

$('button[name="downtest"]').on('click',function(){
    console.log("downbutton push1);
})

$(".downpraise").on('click', function() {
    console.log("downbutton push2);
})

以上两个没有得到任何回应?有什么线索吗?

PS:

columns: [
          { data: 'action',  render: function ( data ) {              

        return  '<button type="button" class="btn btn-default downpraise " data-toggle="tooltip"  data-placement="top" title="downbutton" name="downtest">
             <i class="far fa-thumbs-down">data</i>
       </button>'
  ]

【问题讨论】:

    标签: datatables jquery-on yajra-datatable


    【解决方案1】:

    我解决了这个问题

    $(document).on( 'click', 'button.downpraise', function () {
    }
    

    不知道为什么原来的方法行不通。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-25
      • 2019-04-30
      • 1970-01-01
      • 2016-04-10
      • 2016-03-28
      • 1970-01-01
      • 1970-01-01
      • 2019-05-17
      相关资源
      最近更新 更多