Image complete attribute
Definition and Usage
complete
The property returns whether the browser has finished loading the image.
If the image has been fully loaded, then complete
The property returns true. Otherwise, this property returns false.
Instance
Example 1
Check if the image has been fully loaded:
var x = document.getElementById("myImg").complete;
Example 2
Check if the image has been fully loaded in the body onload event:
<script> function myFunction() { alert("Image loaded: " + document.getElementById("myImg").complete); } </script> <body onload="myFunction()">
Syntax
imageObject.complete
Technical Details
Return Value: | Boolean value indicating whether the browser has finished loading the image. If loaded, returns true; otherwise, returns false. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |