Examples
Setting and Getting HTML content
This article outlines common methods for working with HTML content using RichTextEditor.
1. Getting Content with Javascript
<!-- Create a new DIV element with all of the content that we want inside the Editor -->
<div id="div_editor1"></div>
//Initialize Richtexteditor for the matched element
var editor1 = new RichTextEditor("#div_editor1");
//Setting Content with Javascript
editor1.setHTMLCode("Use inline HTML or setHTMLCode to set the default content.");
<!-- Retrieve the HTML from the editor by using the editor.getHTMLCode() method. -->
<button onclick="alert(editor1.getHTMLCode())">Show Html Code</button>
2. Getting Content Automatically with HTML <form> POST
When RichTextEditor is used to replace a <textarea> element within a <form>, RichTextEditor will mimic the behavior of the original <textarea> when the form is submitted. This means that the contents of the editor are simply posted along with the other form elements, using the name attribute of the original <textarea> as the key.
<!-- Create a new DIV element with all of the content that we want inside the Editor -->
<textarea id="inp_editor1"><p>Initial Document Content</p></textarea>
//Initialize Richtexteditor for the matched element
var editor1 = new RichTextEditor("#inp_editor1");