what is the best way to unbind all?
For example
i start a function someName('mp3Player')
in this function are many binds
function someName(mode)
{
if(mode == 'exit')
{
$('#player').remove();
// unbind all
// ..........
return true;
}
if(mode == 'mp3Player')
{
$('body').append('<div id="player"> *** add some html code *** </div>');
$('#test').draggable ....
$('.myLi').sortable ....
$('myButton').click ....
$('.dragable').live( "dragstop", function (event, ui) ....
return true;
}
}
Any good ideas?
Thanks in advance!
Peter
you can use
unbindordiejquery unbindjquery diein your case you are
livebundingthe event so its better/necessary to usedie` asto unbind single event as maxedison mentioned do
this will unbind the event attached to the element to unbind all the events attached to an element call unbind without any arguments