当我们点击编辑器外面时如何隐藏ckeditor? [英] How to hide ckeditor when we click outside of the editor?

查看:96
本文介绍了当我们点击编辑器外面时如何隐藏ckeditor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

<div id="showReplyDiv">
  <form id="test">
   <div>
       <textarea id="articleEditor" name="articleVO.articleC"></textarea>
           <script type="text/javascript">
            CKEDITOR.replace( 'articleEditor',{customConfig : '/Forum/ckeditor/replyCKEditor.js'}); 
        </script>
    </div>
    <div id="buttonArea">
        <input type="button" id="doReply" value="submit"/>
        <input type="button" id="cancel" value="cancel"/>
    </div>
    </form>
</div>

我想要它,以便当用户点击此 ckEditor <之外的任何地方时/ code>,我可以隐藏它。

I want it so that when the user clicks anywhere outside of this ckEditor, I can hide it.

推荐答案

$('body').click(function(event){

    if($(event.target).parents('#articleEditor').length <= 0)
         $('#articleEditor').hide();
})

这篇关于当我们点击编辑器外面时如何隐藏ckeditor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆