【问题标题】:Get CKEditor content? - jQuery获取 CKEditor 内容? - jQuery
【发布时间】:2011-01-28 07:56:14
【问题描述】:

我的 CKEditor 代码是

window.onload = function()
{
    var editor = CKEDITOR.replace( \'big_info\' );
    CKEDITOR.config.height = \'330px\';
    CKEDITOR.config.toolbar_Full =
    [
        [\'Source\',\'-\',\'Templates\'],
        [\'Maximize\', \'ShowBlocks\'],
        [\'Cut\',\'Copy\',\'Paste\',\'PasteText\',\'PasteFromWord\',\'-\',\'SpellChecker\', \'Scayt\'],
        [\'Undo\',\'Redo\',\'-\',\'Find\',\'Replace\',\'-\',\'SelectAll\',\'RemoveFormat\'],
        [\'TextColor\',\'BGColor\'],

        [\'NumberedList\',\'BulletedList\',\'-\',\'Outdent\',\'Indent\',\'Blockquote\'],
        \'/\',
        [\'Bold\',\'Italic\',\'Underline\',\'Strike\',\'-\'],
        [\'Styles\',\'Format\',\'Font\',\'FontSize\'],
        [\'JustifyLeft\',\'JustifyCenter\',\'JustifyRight\',\'JustifyBlock\'],
        [\'Link\',\'Unlink\',\'Anchor\'],
        [\'Image\',\'Flash\',\'Table\',\'HorizontalRule\',\'PageBreak\']
    ];

    CKFinder.SetupCKEditor( editor, { BasePath : \'/javascript/ckfinder/\', RememberLastFolder : false } ) ;
};

我想从我的 jQuery 脚本中获取编辑框的内容并通过 JSON 发送。我找不到怎么办。

【问题讨论】:

    标签: javascript jquery ckeditor


    【解决方案1】:

    这在integration Guide中有解释

    var editor_data = CKEDITOR.instances.big_info.getData();
    

    您还可以使用 CKEditor blogjQuery integration docs 中解释的 jQuery 集成

    // Get the editor data.
    var data = $( 'textarea.editor' ).val();
    // Set the editor data.
    $( 'textarea.editor' ).val( 'my new content' );
    

    【讨论】:

      猜你喜欢
      • 2012-12-13
      • 2010-10-29
      • 1970-01-01
      • 2014-10-14
      • 2011-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-16
      相关资源
      最近更新 更多