Bit new to Java-script so let me explain my problem. I have implemented pagination using Django
and using Infinitescroll.js
for pagination in Front-end.
Now I want to attach an click-event listener to elements of a class on the page. I can do.
$(".class").on("click",
function(){
alert("1234")
});
First page of Pagination is working fine. But for next page the listener is not getting attached. I tried keeping above js in $(document).ready
but still it's not working. How can I add listeners to new elements of the same class that are being loaded after pagination.
Do I need to put the above code in callback function of the infinitescroll.js
?