Hey i’ve set a toggle event on an element and i wish to remove it somewhere in the code.
How can i remove this?
This is my toggle :
$('#album_cell'+currentCell).toggle(function() {
$('#album_cell'+currentCell).flip({
direction:'lr',
dontChangeColor: true,
content: captionPane
});
}, function() {
$('#album_cell'+currentCell).revertFlip();
});
flip is a plugin i’m using, unrelated to the problem.
I can’t seem to be able to use something like :
$('#album_cell'+currentCell).off('toggle');
So how can i disable it? could i set both of the toggle events as some variables and disable it then?
Because ‘toggle’ is action and not event. Try to remove ‘click’ event. See Best way to remove an event handler in jQuery?
See also examples JQuery.off to disable specific action.