如何使用JQuery获取CKEditor的内容? [英] How can I get the content of CKEditor using JQuery?

查看:62
本文介绍了如何使用JQuery获取CKEditor的内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CKEditor.我正在使用页面方法使用ajax保存表单值.

I'm using CKEditor. I am saving the form values with ajax using page methods.

但是CKEditor值的内容无法保存到表中.

But the content of CKEditor value cannot be saving into the table.

我不回发页面.

我该怎么办?

推荐答案

首先,您应该在页面中包括ckeditor和jquery连接器脚本

First of all you should include ckeditor and jquery connector script in your page,

然后创建一个文本区域

<textarea name="content" class="editor" id="ms_editor"></textarea>

将ckeditor附加到文本区域,在我的项目中,我使用如下代码:

attach ckeditor to the text area, in my project I use something like this:

$('textarea.editor').ckeditor(function() {
        }, { toolbar : [
            ['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],
            ['Undo','Redo'],
            ['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
            ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
            ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
            ['Link','Unlink','Anchor', 'Image', 'Smiley'],
            ['Table','HorizontalRule','SpecialChar'],
            ['Styles','BGColor']
        ], toolbarCanCollapse:false, height: '300px', scayt_sLang: 'pt_PT', uiColor : '#EBEBEB' } );

在提交时使用以下内容获取内容:

on submit get the content using:

var content = $( 'textarea.editor' ).val();

就是这样! :)

这篇关于如何使用JQuery获取CKEditor的内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆