Image complete Property

Image Object Reference Image Object

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

Internet Explorer Firefox Opera Google Chrome Safari

The complete property is supported in all major browsers.


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 Reference Image Object