javascript 获取tinyMCE的内容?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13726489/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get content of tinyMCE?
提问by user1794021
I have a text area with the id of 'article'.
我有一个 ID 为“文章”的文本区域。
Here is what is in my js:
这是我的 js 中的内容:
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "fullpage",
theme_advanced_buttons3_add : "fullpage"
});
And to get the contents of the editor:
并获取编辑器的内容:
var content = tinyMCE.get('article').getContent();
alert(content);
But it doesn't appear to work, any ideas where I'm going wrong?
但它似乎不起作用,我哪里出错了?
采纳答案by yb007
Try to follow this fiddleit may help you in figuring out....
尝试按照这个小提琴它可能会帮助你弄清楚......
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "fullpage",
theme_advanced_buttons3_add : "fullpage"
});
Function for getting content
获取内容的函数
function get_content() {
var content = tinyMCE.get('article').getContent();
alert(content);
}
<textarea name="article">
//content here
</textarea>
Get the content of editor on button click ...
单击按钮获取编辑器的内容...
<button onclick="get_content()">Get content</button>
回答by user4389995
tinyMCE.activeEditor.getContent()