本文介绍了在表单重置按钮上重置ckeditor值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单上有一个表单重置按钮:

I have a form reset button on my form:

<a href="#" id="reset_button" class="btn" onClick="name_of_form.reset();">Reset</a>

这将重置我的表单上除ckeditor以外的所有控件,并且我希望能够重置表单上ckeditor的值.

This resets all the controls on my form except the ckeditor, and I want to be able to reset the value of the ckeditors on the form.

重置了ckeditors的关联文本区域.

The associated text areas of the ckeditors are reset.

那我该如何将ckeditor的重置代码编码到表单重置按钮中?

推荐答案

没有简单的方法可以将CKEditor与<textarea>同步.但是可以将<textarea>与CKEditor( editor.updateElement ).我先将空数据设置为编辑器,然后调用editor.updateElement()重置字段和编辑器:

There's no easy way to synchronize CKEditor with <textarea>. But it is possible to synchronize <textarea> with CKEditor (editor.updateElement). I'd set empty data to the editor first and call editor.updateElement() to reset both field and the editor:

... onClick="CKEDITOR.instances.theInstance.setData( '', function() { this.updateElement(); } )" ...

这篇关于在表单重置按钮上重置ckeditor值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 22:57