title: jQuery image loading icon
body: <p>I'm trying to make it so when a picture is not yet loaded it will add an icon on top of the image.</p>
  
  <p>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.</p>
  
  <pre><code>$(".loading").show();
  
  $(".img").load(function(){
  
      $(".loading").hide();
  });
  </code></pre>
  
  <p>Index:</p>
  
  <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/main.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Apparently i made it work by rewriting my jQuery code:</p>
  
  <pre><code>$(function() {
      $(".loading").show();
  
      $('.img').on('load', function(){
          $(this).parent().parent().find(".loading").hide();
      });
  });
  </code></pre>