I have a requirement where i’m dynamically generating some rows and each row has a button and an id associated with it and i do this using $.post() of jQuery. And this content is periodically refreshed.
A problem has occurred due to this… After $.post has finished its execution, the buttons are not triggering the click event… How do i correct this?
Use jQuery’s .on() method to listen for events on dynamically added DOM elements:
http://api.jquery.com/on/
EDIT:: Make sure you are using jQuery 1.7+. For the older versions, you can try .live() and .delegate().