title: Detect and Add dynamically width and height and alt attribute to all images
body: <p>I am trying to get and add dynamically the width, height and alt attribute for each image on the web page that doesn't have those attributes. But it only detects the first image width height alt attributes and adds them too all images.</p>
  
  <pre><code>$(document).ready(function() {
      var width = $('img').width();
      var height = $('img').height();
      var image_width = $('img').attr('width');
      var image_height = $('img').attr('height');
      var image_alt = $('img').attr('alt');
      if (typeof image_width === 'undefined' || image_width === false &amp;&amp; typeof image_height === 'undefined' || image_height === false) {
          $('img').attr('width', width).attr('height', height);
      }
      if (typeof image_alt === 'undefined' || image_alt === false) {
          $('img').attr('alt', 'image');
      }
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/a9zsqxov/" rel="nofollow">http://jsfiddle.net/a9zsqxov/</a></p>