javascript - jquery .live to .on in jquery upgrade -


i'm upgrading jquery on website jquery v1.10.1 1.4.2 . i'm changing .live functions .on. i'm having trouble changing 1 of them.

function tb_init(domchunk){     $(domchunk).live('click', function(){         var t = this.title || this.name || null;         var c = $(this).parent().parent().find('.quotation').html();         var = this.href || this.alt;         var g = this.rel || false;         var o = $(this);         tb_show2(t,c,a,g,o);         this.blur();         return false;     }); } 

i tried changing to:

$(document).on("click", domchunk, function() { 

and:

$(document).on("click", $(domchunk), function() { 

but both don't seem work. domchunk selector this: "#myid li" error is: uncaught typeerror: object # has no method 'blur'

thanks

this reference dom object , not jquery object.

try instead:

$(this).blur(); 

or:

$(this).trigger('blur'); 

or in code use o instead of $(this)


Comments