Method 1: By using .complete property.
Note:This program will continuously check if the image is loaded using the .complete property of the img element. It will also check for errors. When the image is loaded it will alert with “loaded” alert message box.
Method 2: Using image.onload() method
Note: In this method, Image.onload() is continuously checking if the image is loaded or not. If the image does not load within 5 seconds, it will timeout and show you an error. If the image is loaded after some set time, it alerts message saying “The image has loaded”.
- How to Create a Tab Image Gallery ?
- How to create an image as the border around an element?
- How to create a Hero Image using HTML and CSS ?
- How to create a canvas image using Fabric.js ?
- How to create your own Docker Customised Image ?
- How to Create a Custom Image Magnifier using jQuery ?
- How to Create a Wave Image for a Background using HTML and CSS ?
- How to Create Image Overlay Hover using HTML & CSS ?
- How to Create an Image Overlay Icon using HTML and CSS ?
- How to create a client-side image-map in HTML5 ?
- How to create responsive image gallery using HTML, CSS, jQuery and Bootstrap?
- How to see the extensions loaded by PHP ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.