New to Kendo UI for jQuery? Download free 30-day trial

Set Encoded Special Characters as Editor Values

Environment

Product Progress® Kendo UI® Editor for jQuery
Operating System All
Browser All
Preferred Language JavaScript

Description

How can I set the encoded special characters as Editor values and display them decoded?

Solution

Prior to passing them as a parameter to the value method of the Editor, decode the encoded special characters.

<textarea id="editor"></textarea>
<script>
    $("#editor").kendoEditor();

    var editor = $("#editor").data("kendoEditor");
    var encodedString = "&lt;p&gt;Paragraph with a &gt; special character inside.&lt;/p&gt";
    var parser = new DOMParser;
    var dom = parser.parseFromString(
        '<!doctype html><body>' + encodedString,
        'text/html');
    var decodedString = dom.body.textContent;

    editor.value(decodedString);
</script>
In this article