ajax - Jquery .off all handlers -


maybe relevant i'm missing if use when document ready

$('a.edit').on("click", displayeditform); 

and after ajax call

$('a.edit').off(); $('a.edit').on('click', displayeditform); 

it works, need deattach because of a.click dynamically loaded , aren't want attach once of them. problem works use

$('a.edit').off('click', displayeditform); $('a.edit').on('click', displayeditform); 

and that's not working. doesn't fail of them calling function twice when clicked. doesn't work neither if use

$('a.edit').off('click', '**'); 

any idea why?

thanks

if generating them dynamically can bind click() these :

$(document).on('click' , 'a.edit', function(){}) 

or use $(document).delegate('a.edit', 'click', function(){})

personally use first solution


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -