I know of and research multiple ways to bind events .on()
, .live()
, .click()
, etc. I know .live()
is deprecated in 1.9+. The problem I'm encountering is binding dynamic DOM elements to events.
I have a div
that contains links and is paginated. The links are dynamically loaded with AJAX. I want to overwrite binded events for these links so I used .unbind()
and tried .on()
. The problem is that these dynamically loaded links are not binded. I guess that's because the selector $('#id_of_links')
is cached with the previous set of links.
QUESTION: Is it possible to bind all elements that are loaded on the page, at any point in time, without having to set a callback when the user clicks next page on the links?