kendo-uikendo-editor

Get contents from Kendo Editor in rich text format


I am trying to send data from the kendo editor in an email but the email is displaying html tags. I believe the editor's content is Html, thus, by design its value() method also returns Html. I am struggling to figure out how to get the text from the value.

In my function, I am sending the data like this: "emailmessagehtml": $("#editor").val(), But this is displaying all the html tags in the email.

I would greatly appreciate it if anyone could point me in the right direction to display the rich text content in the email.

Many thanks


Solution

  • Try to use the encodedValue() instead.

    var editor = $("#editor").data("kendoEditor");
    var content = editor.encodedValue();
    

    Documentation

    Check also https://docs.telerik.com/kendo-ui/api/javascript/ui/editor/configuration/encoded

    $("#editor").kendoEditor({
      value: "<p>foo</p>",
      encoded: false
    });
    

    encoded Indicates whether the Editor should submit encoded HTML tags. By default, the submitted value is encoded.