I've read jquery: how to listen to the image loaded event of one container div?
My case is similar: I have a <body contentEditable="true"/>
tag that is edited with a visual editor. The innerHTML of this body is modified by the editor and events are fired.
The problem is that I have to handle a resize logic. The current resize logic in the library is:
this.$body.on('keyup keydown paste change focus', function() {
return _this.adjustHeight();
});
This works pretty fine except the change event is not fired on drag&dropping images, but fortunatly a focus event is triggered. But when the event is fired, the image is not loaded yet so it doesn't resize to the good size.
What is the best way to listen to image loadings for images that are added to the DOM lately using Js code? I tried using $(window).load(fn)
but didn't catch anything.