javascript - Why click event handler doesn't work after sorting the table -


i'm using jquery datatables , have table generated using foreach loop. in each row generated, 2 buttons made different number added data attribute.

after page loads, datatables kicks in , renders table. have onclick handler responds buttons when clicked.

however, when sort table columns datatables capable of doing, buttons not respond onclick handler.

what can prevent datatables causing buttons nothing when either of sorting columns used?

do not use $('.button').click, because buttons recreated when sorted, instead use on jquery event

$(document).on('click', '.button',function(){   //your code }); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -