我在頁面上使用cleditor創建一個RTE框,其下方有一個保存和取消按鈕。cleditor.selectedHTML():對象不支持屬性或方法
在我的保存按鈕的「onclick」功能。我調用了cirtitor對象的兩種方法,即:.select()和.selectedHTML()
.select()可以正常工作,但.selectedHTML()會產生「對象不支持屬性或方法」錯誤在我的瀏覽器(即)。
爲什麼我會收到此錯誤? .selectedHTML()方法確實存在。
見下面的代碼:
var $editor
uab.crs_sum.prototype.render = function() {
var oJSON = {};
var target = this.getTarget();
var tmpHTML = [];
var chkOption = "";
tmpHTML = ["<textarea id='input' name='input'>This is some really great Content</textarea>"];
tmpHTML.push("<div><button style='width:6em'type='button' onclick='cancelEdit();'>Cancel</button><span style='width:3em'>   </span><button style='width:6em' type='button' onclick='saveEdit();'>Save</button></div>");
target.innerHTML = tmpHTML.join("");
$editor = $("#input").cleditor({
"width":"100%"
});
}
function saveEdit() {
$editor.select();
alert($editor.selectedHTML()); // Error occurs on this line
}