分页单击事件不适用于jquery数据表中的页码 [英] Pagination click event not working on page numbers in jquery datatables

查看:105
本文介绍了分页单击事件不适用于jquery数据表中的页码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery数据表.我想在单击表的分页号时执行一些功能.该表的行正在动态生成.问题在于,单击数字时不会触发 onclick 事件,但是会在上一个和下一个链接上触发它.

I am using the jquery datatables . I want to perform some functions on click of pagination numbers of the table . The rows of the table are getting generated dynamically. The issue is that the onclick event is not getting fired when clicking on numbers but it is getting fired on the previous and next links.

我已经使用以下方法绑定了click函数:

I have used the following to bind the click function :

 $(document).on('click',"div.pagination li",function(evt){
 evt.preventDefault();
 alert('clicked!');
 // do some coding
  });

请帮助我确定此处的错误.请提示是否有其他方法.

Kindly help me in identifying what is the mistake here. Kindly suggest if there is an alternative method.

谢谢!

推荐答案

如果通过JQuery创建分页链接,则.click可能无法正常工作,而应使用.bind

If the pagination links are created through JQuery then .click may not work instead use .bind

这篇关于分页单击事件不适用于jquery数据表中的页码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆