Image complete Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Image


The complete property returns whether or not the image is loaded.

Return Value

A Boolean that indicates whether the browser is finished loading the image.

The following code shows how to Check to see if the image is finished loading:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
function myFunction() {//from  w  w  w  . ja  v a  2 s. com
    console.log("Image loaded: " + document.getElementById("myImg").complete);

<body onload="myFunction()">

<img id="myImg" src="" alt="alt message" width="107" height="98">


Related Tutorials