I'm trying to make it so when a picture is not yet loaded it will add an icon on top of the image.
Here's what I have done, I can't really say anything else that it is not doing what it is supposed to do so.
$(".loading").show();
$(".img").load(function(){
$(".loading").hide();
});
Index:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
EDIT:
Apparently i made it work by rewriting my jQuery code:
$(function() {
$(".loading").show();
$('.img').on('load', function(){
$(this).parent().parent().find(".loading").hide();
});
});