Check documentation for the latest version of dhtmlxSuite Object Constructor DHTMLX Docs

Object Constructor

Basic constructor

<div id="editorObj" style="width:100%; height:300px; border:#909090 1px solid;"></div>
myEditor = new dhtmlXEditor("editorObj");
myEditor.setContent("Type some text here");
 
//or with object notation
myEditor = new dhtmlXEditor({
    parent: "editorObj",
    content: "Type some text here"
});

Related sample:  Simple init

Related sample:  Object API init

Available parameters for object notation

Just the 'parent' parameter is mandatory

Parameter Type Description
parent string, object The id or object of HTML element that the editor will be created in
content string The initial content of the editor (note, any HTML is allowed)
contentHTML string the URL to an external resource that will be initially presented in the editor. Loaded by Ajax. Ignored, if the 'content' parameter is specified
toolbar boolean adds a toolbar to the editor. By default, false. Note, to use the toolbar - the 'dhtmlxtoolbar.js' and 'dhtmlxeditor_ext.js' files must be included on the page
iconsPath string the path to toolbar's icons (default icons are located in 'editor/codebase/imgs/'; skin will be detected automatically)
skin "dhx_skyblue", "dhx_web", "dhx_terrace" skin to apply
onFocusChanged function sets a handler function for the onFocusChanged event
onAccess function sets a handler function for the onFocusChanged event

Related sample:  Object API init

Initialization with the toolbar

<link rel="stylesheet" type="text/css" href="codebase/dhtmlxeditor.css"> 
<link rel="stylesheet" type="text/css" href="codebase/dhtmlxtoolbar.css">
<script src="codebase/dhtmlxeditor.js"></script>
<script src="codebase/dhtmlxtoolbar.js"></script>
 
 
<div id="editorObj" style="width:100%; height:300px; border:#909090 1px solid;"></div>
myEditor = new dhtmlXEditor({
    parent: "editorObj",
    toolbar: true,                  //adds the toolbar
    iconsPath: "codebase/imgs/", //path to toolbar's icons
    content: "Type some text here"
});

Related sample:  Init with toolbar

Destructor

To destruct a dhtmlxEditor's instance and clear the memory from it, use unload method:

if (myEditor != null) {
    myEditor.unload();
    myEditor = null;
}

Related sample:  Unloading editor

Back to top