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

Subject:

 

 

 

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'); });

 

references: http://stackoverflow.com/questions/6537323/jquery-function-not-binding-to-newly-added-dom-elements

2016-03-02 19:36:55gstlouis