title: How do I add a .click() event to an image?
body: <p>I have a script that places an image based on a mouse click thanks to <a href="https://stackoverflow.com/users/701879/jose-faeti">Jose Faeti</a>. Now I need help adding a .click() event to the code below so that when a user clicks the image it performs the function shown in the script.</p>
  
  <pre><code>&lt;img src="http://soulsnatcher.bplaced.net/LDRYh.jpg" alt="unfinished bingo card" /&gt;.click()
  </code></pre>
  
  <p>I put the entire code below, in case you want to see it.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
   &lt;script language="javascript" type="text/javascript"&gt;
   &lt;!--
  
   document.getElementById('foo').addEventListener('click', function (e) {
  
  var img = document.createElement('img');
  
  img.setAttribute('src', 'http://blog.stackoverflow.com/wp-content/uploads/stackoverflow-logo-300.png');
  
  e.target.appendChild(img);
  });
  
    // --&gt;
   &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;img src="http://soulsnatcher.bplaced.net/LDRYh.jpg" alt="unfinished bingo card" /&gt;.click()
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Help?</p>