I started using this useful plugin just a few days ago, I ran into the same problem and the user wenyi gave a good answer, but was rather complicated for people who are starting out.
<table id="my-table"> <tr> <a href="#" class="my-link">Details</a> </tr> </table> /* You have to options to detect this click (and more) */ /* Normal way */ $(".my-link").click(function(){ //do something }); /* To solve this click detection problem you will need to use this */ $("#my-table").on('click','.my-link',function(){ //do something });
Why? because every time one html element is added dynamically in the DOM, they cannot be detected with the normal click function.
Additonally:
$(document).on('click','.my-link',function(){
source share