Jquery how to bind click event on dynamically created elements?

Solution 1:

here try this:

<script type="text/javascript">
$(function(){
    $('body').on('click', '.pg_previous,.pg_next', function () {
        jQuery("img.lazy").lazy({});
        alert('ddsda');
    });
});
</script>

Solution 2:

You forgot the DOM ready handler

Encase your code inside the ready handler and should work fine unless you have any errors showing up in our console.

$(function() {
    // Your code here
});