Problem creating pic-viewer with pure JavaScript
<p>I'm learning the basics of JavaScript in a course at school. This because I want to have a big understanding of JavaScript when I'm diving into different libraries.  </p>

<p>I've successfully managed to create a function who spawn a <code>&lt;div&gt;</code> that is hidden with a picture within it (I've cheated with "the pure" JavaScript with the fadeIn function as you see).</p>

<p>The problem now is that i want the function to be dynamic and work for more than just one element. I don't now how to proceed with this problem.</p>

<p>Any help or thoughts will be appreciated. </p>

<pre><code>    &lt;div id="hiddenElement"&gt;
        &lt;img src="#" alt="image" class="maxImg"/&gt;
    &lt;/div&gt;

    var hiddenElement = document.getElementById('hiddenElement');
    anchor.addEventListener('click', spawnImage, false);


    function spawnImage() {
            $(hiddenElement).fadeIn('slow', function() {
                hiddenElement.style.display = 'block';
            });
</code></pre>

<p>looks like this now:
<a href="http://oscarlandstrom.se/javascript/pic.html" rel="nofollow">http://oscarlandstrom.se/javascript/pic.html</a></p>
