【发布时间】:2011-10-05 12:25:52
【问题描述】:
我正在试验各种 WYSIWYG javascript 文本区域。如果我尝试使用 jquery 在我的屏幕上的每个<textarea> 上放置一个 CKEditor,编辑器都显示得很好,但他们不保存。我试过了:
$(function() {
$('.editors').ckeditor();
});
和
$(function() {
$('.editors').each(function(index, element){
$(element).ckeditor();
});
});
在这两种情况下,每个文本区域都有一个 CKEditor,但它不保存。如果我手动添加所有编辑器
$(function() {
CKEDITOR.replace('contactText');
CKEDITOR.replace('edit_footer_text');
CKEDITOR.replace('termsText');
});
或
$(function() {
$('#contactText').ckeditor();
$('#edit_footer_text').ckeditor();
$('#termsText').ckeditor();
});
所有三个字段都有编辑器,并且它们保存。
我正在尝试在该项目的标准模板中添加一些代码,这样如果我们想要文本区域的编辑器,他们只需向它们添加类“编辑器”,这就是我要寻找的原因jQuery 解决方案。这确实适用于tinymce:
$(function() {
$('.editors').tinymce({
script_url : '/common/tiny_mce/tiny_mce.js',
// General options
mode : "textareas",
theme : "advanced",
})
});
【问题讨论】: