爲什麼這得到'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