最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to set Html Content in TinyMCE - Stack Overflow

programmeradmin4浏览0评论

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 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

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

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 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

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

Share Improve this question edited Jan 11, 2016 at 9:28 NorCode asked Jan 11, 2016 at 8:01 NorCodeNorCode 6891 gold badge12 silver badges33 bronze badges 1
  • Did you try to refresh the tinyMCE after data is set? – anmarti Commented Jan 11, 2016 at 8:22
Add a ment  | 

1 Answer 1

Reset to default 6

You could try

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

or

tinymce.get("textfull").getBody().innerHTML = d.Description;
发布评论

评论列表(0)

  1. 暂无评论