Strange Javascript behaviour
<p>I am using JQuery to append images, like this:</p>

<pre><code>$('#event_list_main').append('&lt;img class="listed_event" id="event_'+event_counter+'" data-count="'+event_counter+'" src="final_tutorial_buttons/event.png" height="50" width="50" onclick="highlight();" /&gt;');
</code></pre>

<p>I am assign a <code>highlight</code> function to each image I create and append! The problem is that the highlight function does not execute.</p>

<pre><code>//Highlight function
function highlight()
{
    var indicator = $(this).data("count");
    alert(indicator);

}
</code></pre>

<p>the "this" part doesnt seem to work.I want this to refer to each event created.</p>

<p>for example if I created 3 events</p>

<p>event_1
event_2
event_3</p>

<p>and I click on "image event_2" then "this" must refer to "image-event_2"</p>
