Trying to get the text written inside a TinyMCE textarea

蓝咒 提交于 2019-12-03 22:18:13

Why don't you simply use tinymce.get('jander').getContent(); (tinymce in lowercases!) ?

You should simply request the value of the original textarea control.

tinyMCE.triggerSave(false, true);
$('#jander').val();

Once you've included the TinyMCE jQuery plugin, you assign the editor to a variable and can then operate any jQuery function on it:

var wysiwyg = $('textarea.tinymce').tinymce(tinymce_settings);

Then to get the contents you can just fetch wysiwyg.html();

Also, see the TinyMCE jQuery documentation for other manipulation techniques.

As someone told me, the sharp character (#) is used in jQuery selectors and has nothing to do with tinyMCE.get(). So with this line below works ok.

alert(tinyMCE.get('jander').getContent());   

try this one....

$.trim(tinymce.get('jander').getContent());

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!