Open In App

HTML DOM Image complete Property

The Image complete property in HTML DOM is used for returning whether the browser is finished loading an image or not. It returns a Boolean value. 

Syntax: 



imageObject.complete

Return value: It returns a Boolean value i.e. true when the browser finished the loading of an image otherwise it returns false. 

Example: This Example returns an Image complete Property.  






<!DOCTYPE HTML>
<html>
   
<head>
    <title>
        HTML | DOM Image complete Property
    </title>
</head>
   
<body>
    <img src=
         id="image" width="250" height="205"
         class="alignnone size-medium wp-image-1092360" />
    <br>
    <br>
    <button type="button" onclick="getHeight()">
        Click
    </button>
    <h4 id="text"></h4>
    <script>
        function getHeight() {
            let imgObject = document.getElementById("image");
            let output = document.getElementById("text");
            output.innerHTML =
                "The Image is loaded completely: " + imgObject.complete;
        }
    </script>
</body>
 
</html>

Output: 

 

Supported Browsers: The browsers supported by HTML DOM Image complete property are listed below: 


Article Tags :