我正在尝试使用以下代码从我的 SCEditor textarea 获取值:
var fbeschreibung = '';
$(function() {
// Replace all textarea's
// with SCEditor
$("textarea").sceditor({
plugins: "bbcode",
style: "css/style.less",
width: "100%",
toolbar:"bold,italic,underline,strike,subscript,superscript|left,center,right,justify|size,color,removeformat|bulletlist,orderedlist,horizontalrule,emoticon",
locale:"de" ,
resizeEnabled:false
});
fbeschreibung = $('textarea').sceditor('instance').val();
$('textarea').sceditor('instance').val('Hello [b]World![/b]');
});
然后我想通过 AJAX 发送值:
$.post('saveprofile.php',
{fbeschreibung : fbeschreibung},
function (response) {
alert(response);
}
);
但是,我无法让它工作。我没有在文档中找到任何提示:http ://www.sceditor.com/api/sceditor/val/
我的变量fbeschreibung
只是空的。是不是我做错了什么?