You can try something like this:
$('#someselector') .prepend('<img src="/img/myimage.gif" id="someid" />') .find('#someid');
Or if there is only one img:
$('#someselector') .prepend('<img src="/img/myimage.gif" id="someid" />') .find('img');
As an alternative:
$('<img src="/img/myimage.gif" id="someid" />').prependTo('#someselector')
source share