How to check image loaded or not in JQuery?

By Hardik Savani | April 15, 2016 | | 1339 Viewer | Category : Javascript jQuery


Share this post:



Sometimes we need to detect upto image load successfully, for example you want to do print text instead of image before load image. so you can do that using jquery load and error method. you can see bellow example:

Example:

<script type="text/javascript">

$('.image')

.load(function(){

console.log("Now loaded correctly");

})

.error(function(){

console.log("Found Error in loading image");

});

</script>