Examples
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:
<!-- Create a new DIV element that RichTextEditor should replace to your HTML page. -->
<div id="div_editor1"></div>
//Then call new() method to replace the matched element with RichTextEditor.
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:
//Setting the editor data
editor1.setHTMLCode("<p><b>Hello</b> World</p><p>Click the button below to show this HTML code</p>");
function btnShowHTMLCode() {
// Getting the editor data
alert(editor1.getHTMLCode())
}