title: Getting width and height of a dynamic image
body: <p>I have a <code>img</code> tag embedded inside a hidden <code>div</code>. When the user clicks on a dynamic hyperlink, having the image name, the image has to be showed in a modal window. For positioning the div inside the modal window, the image height is required. But when the hyperlink is clicked, the after the <code>src</code> is assigned, the height is coming as <code>0</code>. So the image cannot be aligned in the middle. Please help me to get the width of the image before the it is shown in the browser.</p>
  
  <pre><code>&lt;div id="imgFullView" class="modal_window imgFullView"&gt;
      &lt;img alt="Loading..." id="imgFull" /&gt;
  &lt;/div&gt;
  
  function ShowImage(imgSrc) {
      $("#imgFull").attr("src", imgSrc);
      alert($("#imgFull").height());
      $("#imgFullView").width($("#imgFull").width());
      $("#imgFullView").height($("#imgFull").height());
      show_modal('imgFullView', true);
  }
  </code></pre>
  
  <p>This <code>showimage</code> method would be called <code>onclick</code> of the hyperlink.
  Thanks in Advance...</p>
  
  <p>Solution that worked for me, after all your professional guidance...</p>
  
  <pre><code> function ShowImage(imgSrc) {
      $("#imgFull").removeAttr("src"); //To remove the height and width of previously showed imaged from img tag.
      $("#imgFull").attr("src", imgSrc);
      $("#imgFullView").width(document.getElementById("imgFull").width);
      $("#imgFullView").height(document.getElementById("imgFull").height);
      show_modal('imgFullView', true);
   }
  </code></pre>