jquery event not firing
Posted: Fri Jan 20, 2012 11:59 am
Not quite sure why this doesn't work, I have tried all variations of event delegations... .delegate() .mousedown() .delegate() .bind() and .live(). The only one that works is live(), but since it's part of a context menu that will be added to the page many times and on many different elements, the live event is not an option. Any help would be greatly appreciated, I can't seem to see why this isn't firing off.
Code: Select all
$("#" + old_n).on('mousedown', function(evt) {
console.log(old_n);
if($(el).data('clickphase')) return true;
$("#" + $.contextmenu).remove();
$(el).data('served', true);
if(typeof array_of_a[a_index][1] == 'function') {
array_of_a[a_index][1](evt, el);
}
//console.log(array_of_a[a_index]);
//array_of_a[a_index][1](evt, el);
$(el).removeData('served');
});