Handling Events

Attaching Event Handler

To attach a handler function to an event, use the attachEvent method:

var myEditor = new dhtmlXEditor(parent: "editorObj");
 
myEditor.attachEvent("onAccess", function(name, ev){
    alert("onAccess event fired, name: "+name);
});

Related sample:  onAccess event

Several handlers can be attached to one and the same event, and all of them will be executed.

The names of the events are case-insensitive.

Detaching Event Handler

To detach a handler function from an event, use the detachEvent method:

var eventId = myEditor.attachEvent("onAccess", function(name, ev){
    alert("onAccess event fired, name: "+name);
});
 
myEditor.detachEvent(eventId); // the unique id of the event handler

List of supported events

You can find the full list of editor's events in the Editor API.

Back to top