Skip to content
Advertisement

Problem getting JQuery data-id value after clicking datatable navigation

I got bug when I use JQuery data-id in jQuery Datatables. For the first 10 (Ten) record working well. But when I click navigation table to enter to the second page, the data-id value not shown. Please see my code below :

JavaScript

And this is the javascript code:

JavaScript

on the first 10 recode its work well, but when I click button to go to the second page of datatable navigation the data-id dosen’t work… I dont know where is the problem… sory about my English…

Advertisement

Answer

As per the comments above here is the answer…

The below only listens to click events that are rendered before the code is executed.

JavaScript

Replacing that with the below listens to the click event on the entire document, so dynamically created elements (such as your table pagination) will be included.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement