Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ron on Jan 11, 2009 05:22
open dhtmlx forum
Deactivate/drop dhtmlxEvent

Hello,

In application I use dhtmlxEvent(document.body,"click",function(){ mycal.close();}); to close calendar when clicked outside calendar object.

My question is: How to deactivate/drop this event?

This event is active even when object is no longer available on page but still do his unnecessary work.

Answer posted by Support on Jan 12, 2009 02:28
There is no backward method included in common library, but can be done as

var custom_call = function(){ mycal.close();
dhtmlxEvent(document.body,"click",custom_call); 
....
//when event need to be removed
if (_isIE)
    document.body.detachEvent("onclick",custom_call);
else
    document.body.removeEventListener("click",custom_call);