'Reinitiate events listeners javascript/jquery

I have a page in which content is brought in via ajax. The problem I am having is adding the relevant event listeners after the content has loaded. Is there a way to tell the browser to run all the scripts from the head again?

Below is a simple example of code that gets run from the head of the page, obviously any new html elements matching .RRCustomizeBox .customize brought in via AJAX will not have the following click event.

e.g.:

_vvdCMS.kklsRegions = {

    init: function (){
        $(document).ready(function(){
            
            $('.RRCustomizeBox .customize').click( function(){
                _vvdCMS.kklsRegions.showRRCustoms(this);
            });
            
        });
    },
    
    showRRCustoms: function(obj) {
        var objParent = $(obj).parent();
        objParent.find('.RRCustomizeBoxForm').fadeIn(700);
    }
}
_vvdCMS.kklsRegions.init();


Solution 1:[1]

This may be a late but this is what I do when I need ajax.

$(document).ready(function () {
$(document.body).on('click', '.Selector_S', function () { function_F(event, this) })
}

function function_F(event, d){
...do sth here...
}

And you dont need to reinitiate event listeners at all or write anything in ajax function.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Flood Gravemind