Javascript/jquery event not getting bind with elements loaded using ajax

Just a rough guess but if the element doesn’t exist yet then you need to start from an element that is already in the page and then it will find the dynamic target.

e.g.

 $("body").on("click",".ui-dialog .lia-list-tree .lia-list-tree-toggle-container a", function(event){
        event.preventDefault();                                                                                                                                                                       
        if($(this).attr('href')!=="#"){
        	$(window).unbind(); 
                window.location.href=$(this).attr('href');
        }
});
2 Likes