editor.setHTMLCode()

This method is used for setting the content of RichTextEditor.

Syntax

editor.setHTMLCode(strHTMLCode)

Parameter

Type: String

The string that will overwrite the content of editor.

Options (optional, core 2.6.10+)

editor.setHTMLCode(html, { undoable: true }) records the current content as an undo step first, so Ctrl+Z brings it back. Without it, the new content becomes the starting point of the undo history (what you want when loading a document; not when replacing one the user was editing).

Example usage

var editor1 = new RichTextEditor("#div_editor1");      
      
editor1.setHTMLCode("<p><b>Hello</b> World</p>"); 

Related