How to check image loaded or not in JQuery?

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Today now in this post i will share with you How to check image loaded or not in JQuery? Sometimes on our project we need to detect upload image 100% load successfully, for this example if you want to do print any text instead of image before load image. So we can do this by using jquery load and error method. We can see in the 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>

Read Also : How to convert Object into Array in PHP?

Thanks for read. I hope it help you. For more you can follow us on facebook.

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →