NorCode
NorCode

Reputation: 689

How to set Html Content in TinyMCE

I am working on eCommerce Project where Html text editor is needed and i choose TinyMCE. TinyMCE is nice editor for editing text.

I use Asp.net MVC4 and mysql database for storing data of tinyMCE. I am easily able to get the content of tinyMCE editor By using

tinymce.get("textfull").getContent({ format: 'raw' }).replace(/</g, "&lt;").replace(/>/g, "&gt;");

this code provide me HTML encoded text but i want to show this text on new tinyMCE Editor by using this code

tinymce.get("textfull").setContent($("<div/>").html(d.Description).text());

but this code set html Text not Html rendered content on browser TinyMCE Result

Please tell me what is the correct way to show as HTML Element not text.

Upvotes: 5

Views: 7835

Answers (1)

Thariama
Thariama

Reputation: 50832

You could try

tinymce.get("textfull").getBody().innerHTML = $("").html(d.Description).text();

or

tinymce.get("textfull").getBody().innerHTML = d.Description;

Upvotes: 6

Related Questions