Editor output
Choose an output format to inspect the current editor content.
Example code
<div id="div_editor1"></div>
<script>
var editor1 = new RichTextEditor("#div_editor1");
editor1.setHTMLCode("<p><b>Hello</b> World</p><p>Click the button below to show this HTML code</p>");
function showOutput(label, value) {
document.querySelector("#editor_output_label").textContent = label;
document.querySelector("#editor_output").textContent = value;
}
function btngetHTMLCode() {
showOutput("HTML output", editor1.getHTMLCode())
}
function btnsetHTMLCode() {
editor1.setHTMLCode("<h1>editor1.setHTMLCode() sample</h1><p>You clicked the setHTMLCode button at " + new Date() + "</p>")
}
function btngetPlainText() {
showOutput("Plain-text output", editor1.getPlainText())
}
</script>
<div class="content-space-1">
<button class="ls-secondary" onclick="btngetHTMLCode();return false;">Get HTML code</button>
<button class="ls-cta" onclick="btnsetHTMLCode();return false;">Set HTML code</button>
<button class="ls-secondary" onclick="btngetPlainText();return false;">Get plain text</button>
</div>
<h3 id="editor_output_label">Editor output</h3>
<pre id="editor_output" role="status" aria-live="polite">Choose an output format.</pre>