Archive for tag: jQuery off(eventname - function)

Remove events with jquery or javascript

This is the function that we have bound it as below:

$(function(){ 
    //remove click doSomething
    $("div").click(doSomething1); 
}); 

 In jQuery we can do add and remove events as we go along, there are two way that we can remove or unbind event of jQuery

$('div').off('click', doSomething); 
 
// or 
 
$('div').unbind('click', doSomething); 

 if is there any batter way then caould yo ucomment down below please,

I hope this would help.

Thanks