最近的项目中遇到个很头疼的问题,异步提交表单后需要清空表单数据,项目中文本编辑器是ckeditor,用了好几种方式都无法将提交后的表单清空。
最后发现这种方式可以:
document.form1.reset();
CKEDITOR.instances.caseText.setData(' ');
开始采用jquery的 $("#caseText").val(''); 试试之后发现此方式不成功。
采用: document.form1.caseText.value='' 发现也是不可以。
采用:
var o = $("#caseText").cleditor()[0];//关键是这里获取第一个对象,否则upateFrame无法调用
$('#caseText').html(' ');
o.updateFrame();
document.form1.reset();
不但没有清除表单值反倒把原来清空的都填回去了。
具体说下我配置ckeditor.
$(function() {
CKEDITOR.editorConfig = function( config )
{/*
config.language = 'zh-cn';
config.toolbar = 'Background';
config.toolbar_Background = [
['Bold','Italic','Underline','Strike','-','Subscript','Superscript','RemoveFormat'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl'],
['NumberedList','BulletedList','-','Outdent','Indent'],
'/',
['Styles','Format','Font','FontSize'],
['TextColor','BGColor'],
['Link','Unlink'],
['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
['Maximize','ShowBlocks']
];
config.resize_enabled = false;
config.font_names = 'Arial;Verdana;Times New Roman;Georgia;Tahoma;宋体;黑体;微软雅黑';
config.disableObjectResizing = false;
*/
config.language = 'zh-cn';
config.toolbar = 'Background';
config.toolbar_Background = [
['Bold','Italic','Underline','Strike','-','Subscript','Superscript','RemoveFormat'],
['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo'],
['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
'/',
['FontSize'],
['TextColor','BGColor'],
['Link','Unlink','Table'],
['NumberedList','BulletedList','-','Outdent','Indent'],
['BidiLtr','BidiRtl']
];
//config.entities = false;
config.resize_enabled = false;
config.disableObjectResizing = false;
config.filebrowserImageUploadUrl = 'ckupload?type=Images';
};
CKEDITOR.replace( 'caseText', { customConfig : 'config_front.js' }) ;
});
开始时候为了取值需要,将
var editor = CKEDITOR.replace( 'caseText', { customConfig : 'config_front.js' }) ;
设置成了全局变量,导致每次加载时候会报 存在实例错误。
为了避免类似错误,建议使用:
CKEDITOR.instances.caseText.setData(' ');
方式获取数据。
分享到:
相关推荐
在这个包中,包含了原来的代码,当时这里调用了CKEditor api中的js函数,从而解决了CKEditor的项目路径问题,在CKEditor的自定义标签中不支持表达式,所以不能使用项目路径,所以需要使用js代码解决
但网上很多配置都有问题,自己摸索了好久终于搞定。需要注意的细节有:flvPlayer文件夹的内容直接放在ckeditor文件夹里面的plugins文件夹下面。然后配置config.js文件的节点:config.extraPlugins = 'flvPlayer'; ...
把ckeditor 3.4的ckeditor.js复盖就行
ckeditor
Ckeditor4菜单栏 Ckeditor4与ie兼容问题 菜单选项不能展开
直接在ckeditor的按钮中显示文件浏览按钮,点击后打开文件浏览窗口,上传或管理文件(必须安装ckfinder先) config.js中添加名为File的按钮 config.js中添加 ... 创建目录 ...ckeditor/skins/v2/file.gif
本插件源码来自互联网,由于源代码基于ckeditor3.6.61,故对源码进行过简单修改,以求适应ckeditor4.4.7
之前在网上下载的都不可以用,于是想尽办法发现是网上提供的是不支持最新的ckeditor.用法找见自己的ckeditor地址让后放到ckeditor/plugins/ 下,最后修改ckeditor/config.js,如果之前添加过工具则在 config....
ckeditor5-v30 全工具版 ,基本将免费的工具备齐了,源文件,可自行修改重新打包,node_modules 文件夹为包文件,该文件夹容量较大,在实际应用时可以删除,必须在网站模式使用,如:...该版本表格插件与微软的edge...
ckeditor插件工具,ckeditor插件工具,ckeditor插件工具,ckeditor插件工具,
ckeditor4音频视频上传自定义插件
ckeditor
ckeditor4.3.2
不错编辑器 最新版本ckeditor4.0 最新版本
用于最新CKEditor4.0的行距插件,不能用于CKEditor3.X.X及以前版本
ckeditor最新
FLV视频格式具有本身占有率低、视频质量良好、体积小等特点,非常适合在网络...但是,在新版本的CKEditor里却没有FLV格式视频的支持。于是我自己动手开发CKEditor的FLV视频播放插件现在上传。PS:这个版本是.net版的。
ckeditor文件
ckeditor 行间距插件
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>-------引进CKEditor控件 【图书特色】 <CKEditor:CKEditorControl ID="bookFeature" runat="server" ></CKEditor:...