Image complete Property
Example
Check to see if the image is finished loading:
var x = document.getElementById("myImg").complete;
The result of x could be:
true
Try it Yourself »
Definition and Usage
The complete property returns whether or not the browser is finished loading an image.
If the image is finished loading, the complete property returns true. If the image is not finished loading, this property returns false.
Browser Support
Property | |||||
---|---|---|---|---|---|
complete | Yes | Yes | Yes | Yes | Yes |
Syntax
imageObject.complete
Technical Details
Return Value: | A Boolean that indicates whether the browser is finished loading the image or not. Returns true if the loading is finished, otherwise it returns false |
---|
More Examples
Example
Check to see if the image is finished loading on body onload:
<script>
function myFunction() {
alert("Image loaded: " +
document.getElementById("myImg").complete);
}
</script>
<body onload="myFunction()">
Try it Yourself »
Image Object