Scenario 1:
$(function () {
$('#disp_body').on('change', '#image', showMyImage(this));
});
If I call the function showMyImage
directly it calls on page load itself.
Scenario 2:
But if I call through closure function. The event properly listened and handled. So it's working properly.
$(function () {
$('#disp_body').on('change', '#image', function() {
showMyImage(this);
});
});
I like to know really why the scenario 1 is not working but scenario 2.