how to bind dynamically event handlers to new elements in DOM from ajax





I have same problem like question I was just near to pulling my hair then i got the solution. I was using different syntax

$(".innerImage").on("click", function(){ alert("test"); });

it was not working for me (innerImage is dynamically created dom) Now I'm using

$(document).on('click', '.innerImage', function() { alert('test'); });



2016-03-02 19:36:55gstlouis