Documents

Initialization

RichTextEditor JavaScript global enables you to create, modify and interact with instances of the editor. This is the starting point for any integration. Creating an editor is done using the static new() method.

Creating an editor:

  1. <!-- Create a new DIV element that RichTextEditor should replace to your HTML page. -->  
  2. <div id="div_editor1"></div>  
  1. //Then call new() method to replace the matched element with RichTextEditor.  
  2. var editor1 = new RichTextEditor("#div_editor1");  

Constructor definition :

new RichTextEditor(elementOrQuery, config)

Parameters:

elementOrQuery : an element object , or "#id" , or ".classname" etc

config : options to initialize the editor

Remarks:

The element could be <div> or <textarea> .
If the element is <div> , the innerHTML of the <div> will be loaded as the initial document content.
If the element is <textarea> , the value of the <textarea> will be loaded as the initial document content.

Interacting with the editor:

  1. //Setting the editor data  
  2. editor1.setHTMLCode("<p><b>Hello</b> World</p><p>Click the button below to show this HTML code</p>");  
  3. function btnShowHTMLCode() {  
  4.   // Getting the editor data  
  5.   alert(editor1.getHTMLCode())  
  6. }