获取 CKEditor 内容? - jQuery

发布于 2024-10-15 01:02:10 字数 1113 浏览 1 评论 0原文

我的 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 发送它。我找不到怎么办。

My CKEditor code is

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

I want to take the content of the edit box and send it via JSON from my jQuery script. I can't find how do to it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心的位置 2024-10-22 01:02:10

集成指南对此进行了解释。

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

您还可以使用 jQuery 集成,如中所述CKEditor 博客jQuery 集成文档

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

This is explained in the integration Guide

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

You can use also the jQuery integration as explained in the CKEditor blog and jQuery integration docs

// Get the editor data.
var data = $( 'textarea.editor' ).val();
// Set the editor data.
$( 'textarea.editor' ).val( 'my new content' );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文