Availability: >= 3.0

Type: Object Method

Description: Allows you to set up JavaScript API Editor Events when constructing the editor.


$editor->addJSEditorEventstring $eventnamestring $function );

This method provides a convenient hook into the JavaScript API.

An Editor Event is a JavaScript function that is called when an event occurs within the editor. 


The name of the editor event that should trigger this function.

The JavaScript function to be called when the event is triggered. This could be the name of an existing JavaScript function or the function code itself.


The following creates a function that alerts the user when the editor has finished loading and is ready to be used:

$editor->addJSEditorEvent('load''function(EDITOR) { alert("The editor is now loaded."); }');