function checkSize(image) { img = new Image(); img.src = image.attr('src'); img.onload = function() { console.info(this.width); }; } checkSize($('img#einBild'));
Es ist hier nicht nötig auf eigene Faust mit DOM-Objekten zu jonglieren. jQuerys Pendant zur onload-Eigenschaft ist die load-Methode:
$('img#einBild').load(function(loadEvent){
$image = $(loadEvent.target);
console.log($image.width());
});