Its a little bit hackish and I am not sure it will work everywhere.
Do test at your own.
$.fn.isLoaded = function(message) {
var $this = $(this);
if($this.height() > 0 && $this.width() > 0){
return true;
}
return false;
};
$('#myimage').isLoaded()
EDIT:
This works in ff and chrome,
$.fn.isLoaded = function(message) {
var $this = $(this);
$this.hide(); // becaues firefox gives a 24*24 dimension
var w = this[0].width;
var h = this[0].height;
$this.show();
if(w > 0 || h > 0){
return true;
}
return false;
};
console.log($('#myimage').isLoaded());
but if you hide the image ie gives 0 as width and height, so it fails for ie. For ie, you shouldnt hide the image.
I hope, somebody can combine both these features to make a cross browser thing or atleast it will help somebody for sure.