unbind

Remove a previously attached event handler.

Parameters

eventName String (optional)

The name of the event. If not specified all handlers of all events will be removed.

handler Function (optional)

The handler which should no longer be executed. If not specified all handlers listening to that event will be removed.

Example

<script>
var obj = new kendo.Observable();
var numberOfCalls = 0;
function handler(e) {
    numberOfCalls ++;
}
obj.bind("myevent", handler); // subscribe to the event
obj.trigger("myevent"); // fire the event
obj.unbind("myevent", handler); // unsubscribe from the event
obj.trigger("myevent"); // fire the event
/* The result can be observed in the DevTools(F12) console of the browser. */
console.log(numberOfCalls); // outputs "1"
</script>
In this article
Not finding the help you need? Improve this article