Skip to content Skip to sidebar Skip to footer

Calling Javascript Function After Loading An Ajax Page

I'm not a programmer so I apologize if my question doesn't make a lot of sense. But basically I have one page index.php that has a set of filters (by project, year, month) and afte

Solution 1:

Once I have the table loaded through filterData.php, it doesn't work anymore.

Use live or better on depending on version of jQuery you are using:

$('#mainContainer').on('click', '.thumbnail_small', function(){
    $(this)
        .css('border-color','#000')
        .siblings()
        .css('border-color','#ccc');
});

Or

$('.thumbnail_small').live('click', function(){
    $(this)
        .css('border-color','#000')
        .siblings()
        .css('border-color','#ccc');
});

For elements that are added later or dynamically, you got to use live or on.

Post a Comment for "Calling Javascript Function After Loading An Ajax Page"