Javascript 编辑程序事件句柄
我有一个表格,我希望每个单元格都可以编辑。 I当用户单击单元格时,每个单元格都可以编辑 我的代码可以很好地完成这项工作,我希望更新后的数据可以在编辑完成时更新到服务器数据库,因此我捕获模糊事件来执行此操作,问题是当我在工具栏中选择文本颜色时,模糊事件也会触发,因此,您能告诉我修复此问题吗?或者有没有其他方法来完成这项工作 这是我的密码:Javascript 编辑程序事件句柄,javascript,jquery,ckeditor,Javascript,Jquery,Ckeditor,我有一个表格,我希望每个单元格都可以编辑。 I当用户单击单元格时,每个单元格都可以编辑 我的代码可以很好地完成这项工作,我希望更新后的数据可以在编辑完成时更新到服务器数据库,因此我捕获模糊事件来执行此操作,问题是当我在工具栏中选择文本颜色时,模糊事件也会触发,因此,您能告诉我修复此问题吗?或者有没有其他方法来完成这项工作 这是我的密码: <html> <head> <script typ
<html>
<head>
<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.12.0.min.js"></script>
<script language="javascript" src="ckeditor/ckeditor.js"></script>
<script language="javascript" src="ckeditor/adapters/jquery.js"></script>
<script language="javascript">
$(document).ready(function() {
$("[id^='editor']").ckeditor().on("blur",function(){alert($(this).ckeditor().editor.getData());return false;}); </script>
</head>
<body>
<table border=1>
<tr>
<td>
<div id="editor1" contenteditable="true">
<h1>Inline Editing in Action!</h1>
<p>The "div" element that contains this text is now editable.</p>
</div>
</td>
</tr>
<tr>
<td>
<div id="editor2" contenteditable="true">
<h1>Inline Editing in Action!</h1>
<p>The "div" element that contains this text is now editable.
</div>
</td>
</tr>
</table>
</body>
</html>
非常感谢当您打开文本颜色面板并选择其中的任何颜色时,不应触发模糊。我检查了它,它是WFM–在我真正模糊编辑器之前,模糊不会被触发。因此,如果您可以创建一个显示错误的示例,那么值得报告它。
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here.
// For complete reference see:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config
// The toolbar groups arrangement, optimized for a single toolbar row.
config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker' ] },
{ name: 'forms' },
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
{ name: 'links' },
{ name: 'insert' },
{ name: 'styles' },
{ name: 'colors' },
{ name: 'tools' },
{ name: 'others' },
{ name: 'about' }
];
// The default plugins included in the basic setup define some buttons that
// are not needed in a basic editor. They are removed here.
config.removeButtons = 'Anchor,Underline,Strike,Subscript,Superscript,Link,Unlink,Styles,About,HorizontalRule,Blockquote,Italic,SpellChecker,SpecialChar,Format';
// Dialog windows are also simplified.
config.removeDialogTabs = 'link:advanced';
config.extraPlugins = 'onchange';
};