The append function returns the contained element, not the one that was added, so you are binding your function to loading the body, not to img.
I suggest using appendTo, for example:
$('<img id="ad" src="img/ad.jpg" alt="Advertising Network" />') .load(function(){ console.log('ad load complete'); $('#submit').click(); }) .appendTo($('body'));
source share