title: JQuery append images in a for loop
body: <p>I am trying to append the same image multiple times to a div element inside a for loop. However, the output I'm getting is just &quot;[object HTMLImageElement]&quot;. The stuffDisplayed variable is initialized to 48 at the top of the file.</p>
  <pre><code>var stuff = new Image();
  stuff.src = &quot;images/stuff.png&quot;;
  
  function createStuff()
      {
          var stuffPerRow = 8;
          var numRows = stuffDisplayed / stuffPerRow;
          
          for (var i = 0; i &lt; numRows; i++)
          {
              $(&quot;#stuff&quot;).append('&lt;div id=&quot;row' + i + '&quot;&gt;&lt;/div&gt;');
              
              for (var j = 0; j &lt; stuffPerRow; j++)
              {
                  $(&quot;#row&quot; + i).append(&quot;&lt;a src=&quot; + stuff.src + &quot; href=#&gt;&quot; + stuff + &quot;&lt;/a&gt;&quot;);   
              }
          }
      }
  </code></pre>