I allow the user to insert an object, an image, and then i call a function on that object. What seems randomly to me, sometimes it works and sometimes not, I guess it has t
Did you try use the reference you already have?
var obj = jQuery('', {
id: objId,
class: 'object_image',
}).appendTo('#objectbox');
restoreSize(obj);
Maybe it works
EDIT: You can put a timeout 0 to append your function after the browser render...
var obj = jQuery('', {
id: objId,
class: 'object_image',
}).appendTo('#objectbox');
setTimeout(function(){ restoreSize(obj) }, 0);