为什么这得到'cannot call method getContent of undefined'
,这怎么可能?它使用tinyMCE设置我的textarea,但不能完成getContent。不能调用方法tinymce
tinyMCE.init({
plugins: 'paste',
theme : "advanced",
mode : "specific_textareas",
editor_selector : element,
width : width,
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,bullist,numlist,undo,redo,",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
content_css : "hhhng.css",
paste_text_sticky : true,
//select pasteAsPlainText on startup
setup : function(ed) {
ed.onInit.add(function(ed) {
ed.pasteAsPlainText = true;
});
}
});
var x = tinyMCE.get(element).getContent();
更新
,当我从一个按钮,点击呼叫,但为什么不立即工作后TinyMCE的是初始化工作的?是的,它是在一个文档准备块。这不是决策意识给我:S
$("#button").click(function(e) {
e.preventDefault();
console.log(tinyMCE.activeEditor.getContent());
});
它工作在一个按钮点击,因为编辑器初始化到那个时间点 – Thariama 2012-07-06 12:13:09