jquery - loading an image then trigger an event with that image
<p>I am doing some code to insert images to a div, and after loading them, the user might be able to trigger an event by clicking on the images, this doesnt work for some odd reason, here is the code:</p>

<pre><code> $(function(){
    getPictures('pictures.xml');

    function getPictures(picturesXML){
        $.get(picturesXML, function(data){

            var pictures = data;    
            var countElements = $(pictures).find('pic').length;             

            $(pictures).find('pic').each( function( i ){

                var img = $('&lt;img src="images/' + $(this).attr('src') + '" style="top : ' + $(this).attr('top') + 'px; left: ' + $(this).attr('left') + 'px" width=" '+ $(this).attr('w')  +'"/&gt;');

                    img.load( function(){   
                        $('.space').append( $(this) );
                        $(this, 'space').delay(100*i).fadeIn('fast');   
                    });                                 

            })      

            $('.space img').mouseenter(function(){
                alert('hello');

            })

        })
    }
}) 
</code></pre>

<p>Is there anybody here who can help me figuring out this.
Thanks!</p>
