You should use ‘on’ method to attach event to selectors that are not present during page load. Like this:
$(document).on('click', '#id_of_your_image', function(e) {
//your code here
});
update
Binding event to the image after it has been added does not seem to be a good solution.
1
solved event fired by a future loaded element [duplicate]