如何使用 jQuery 隐藏和显示 CKEditor?
以下代码应该允许隐藏/显示 CKEditor 表单
<a onClick="$('#form1').hide();">Hide</a>
<a onClick="$('#form1').show();">Show</a>
<form action="sample_posteddata.php" method="post" id="form1">
<textarea id="editor1" name="editor1">blabla</textarea>
<script type="text/javascript"> CKEDITOR.replace( 'editor1' ); </script>
<input type="submit" value="Submit" />
</form>
但是,此代码在 Chrome 上运行良好,但在 Firefox 上,一旦我切换了编辑器(单击“隐藏”然后单击“显示”),它就变得不可编辑!!
我怎样才能让它在每个浏览器上运行?
谢谢。
The following code should allow to hide/show the CKEditor form
<a onClick="$('#form1').hide();">Hide</a>
<a onClick="$('#form1').show();">Show</a>
<form action="sample_posteddata.php" method="post" id="form1">
<textarea id="editor1" name="editor1">blabla</textarea>
<script type="text/javascript"> CKEDITOR.replace( 'editor1' ); </script>
<input type="submit" value="Submit" />
</form>
However, this code works fine on Chrome but on Firefox, once I have toggled once the editor (one 'hide' click followed by one 'show' click) , it becomes not editable !!
How can I make it work on every browser?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
解决方案是:
Solution is:
我在 http:// 找到了答案dizkover.com/post/67/how-to-show-hide-ckeditor-using-jquery-ckeditor-tip
所以基本上,您必须首先通过执行 ff 来销毁 CKEditor 实例:
I found an answer at http://dizkover.com/post/67/how-to-show-hide-ckeditor-using-jquery-ckeditor-tip
So basically, you have to destory the CKEditor instance first by doing the ff:
看起来这可能会帮助您:
http://dev.ckeditor.com/ticket/544
在我链接的报告中,他们展示了这样的尝试:
Looks like this might help you out:
http://dev.ckeditor.com/ticket/544
In the report I linked to they show trying something like this:
似乎没有真正的解决方法。
请参阅此处了解更多信息。唯一的解决办法就是等待CKEditor新版本3.4。
It doesn't seem to have a real workaround.
See here for more info. The only solution is to wait for CKEditor new version 3.4.
尝试将其包装在 div 中,例如:
并使隐藏显示在 div 上。
Try wrapped it in a div eg :
<div id="fckz"> <form >...</form> </div>
and make the hide show on the div .
对于我的 CckEditor 4
For my CkEditor 4