Button Click Events not Firing on Page 2+
Button Click Events not Firing on Page 2+
Hi
I have read the FAQ about using jQuery's on
method when attaching an event to an element within a DataTable. Unfortunately, I still can't get the event to fire on any page other than page 1 of the table :(
Here is a DataTables Live example I have setup: http://live.datatables.net/feridini/1/
You can see that I have added a click event to all elements with the delbutton
class. When the button in the action column is clicked on page 1, clicked is shown in the console window. When having moved to page 2 and the button is clicked, no message is shown in the console window.
Any help or advice would me much appreciated :)
This question has an accepted answers - jump to answer
Answers
You need to use a delegate function: http://live.datatables.net/feridini/2/edit
See the jQuery
on()
documentation for details on how it works.Allan
Thanks Allan :)
Excellent work!