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

2 comments on “Remove events with jquery or javascript”

  1. Gravatar of rolex replica watches  rolex replica watches
    Posted Monday, December 3, 2012 at 11:45:13 PM

    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

  2. Gravatar of LED G24 PLC Lights  LED G24 PLC Lights
    Posted Thursday, October 10, 2013 at 4:28:29 AM

    We’ve known all along that the decision to convert to LED lighting is intelligent; it’s exciting to see these lamps in themselves have become “intelligent lighting.”

Post a comment