How to check image loaded or not in JQuery?

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


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>



Hardik Savani
My name is Hardik Savani. I'm a full-stack developer, entrepreneur and owner of Aatman Infotech. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.
***Do you want me hire for your Project Work? Then Contact US.