hi.
i'm having hard time with binding events in dynamically loaded elements...
i wrote this function:
Code:
function bindLinks(){
console.log('binding');
$('#ajaxDiv > a').click(function(ev){
ev.preventDefault();
otherFunction();
});
}
and now. i'm loading contents with number of links to 'ajaxDiv', then bindLinks() function is triggered (and it works).
but when i empty contents of 'ajaxDiv', load new stuff and bindLinks() is called again, events are not being assigned.
i know function is called since i get console output every time.
any idea how to fix it?