weixin_33701617 2015-09-02 22:18 采纳率: 0%
浏览 35

从SCEditor获取值

I'm trying to get the value from my SCEditor textarea, using this code:

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]');
});

I then want to send the value via AJAX:

$.post('saveprofile.php', 
   {fbeschreibung : fbeschreibung},
   function (response) {
      alert(response);
   }
);

However, I'm not able to get this to work. I haven't found find any tips in the documentation: http://www.sceditor.com/api/sceditor/val/

My variable fbeschreibung is just empty. Is there something I've done wrong?

  • 写回答

3条回答 默认 最新

  • weixin_33701294 2015-09-02 22:35
    关注

    I am not familiar with this particular editor, but the options (comments) I provided you may work.

    var fbeschreibung = '';
    $(function() {
        // Replace all textarea's
        // with SCEditor
        var editor = $("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
        });
        /* Try the following 3 options */
    
        fbeschreibung = editor.val();
        fbeschreibung = editor.getSourceEditorValue();
        fbeschreibung = editor.getWysiwygEditorValue();
    
        editor.val('Hello [b]World![/b]');
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿