I am using JQuery to append images, like this:
$('#event_list_main').append('<img class="listed_event" id="event_'+event_counter+'" data-count="'+event_counter+'" src="final_tutorial_buttons/event.png" height="50" width="50" onclick="highlight();" />');
I am assign a highlight function to each image I create and append! The problem is that the highlight function does not execute.
//Highlight function
function highlight()
{
var indicator = $(this).data("count");
alert(indicator);
}
the "this" part doesnt seem to work.I want this to refer to each event created.
for example if I created 3 events
event_1 event_2 event_3
and I click on "image event_2" then "this" must refer to "image-event_2"
highlightis a global function?'#event_list_main'element...