<div id="showSelectOptions" style="width:100px;height:100px;background-color:red;border:1px solid; ">点击除我之外的地方,关闭我!^_^</div>

jquery 实现代码:

//绑定div之外的点击事件
    $(document).bind("click", function (e) {
        var target = $(e.target);
        if (target.closest("#showSelectOptions").length == 0 ) {
            $("#showSelectOptions").hide();
        }
    });

工作随笔记 点击除div自身之外的地方,关闭自己的更多相关文章

  1. jq点击按钮打开和关闭弹出层,点击除了当前按钮以外的地方关闭弹出层

    1.html <a id="more" onclick="moreFun()">更多</a> <ul id="moreL ...

  2. Android点击EditText文本框之外任何地方隐藏键盘的解决办法

    1,实现方法一:通过给当前界面布局文件的父layout设置点击事件(相当于给整个Activity设置点击事件),在事件里进行键盘隐藏 <LinearLayout xmlns:android=&q ...

  3. swift3.0 点击UIScrollView中输入框之外的区域关闭键盘

    通过点击事件实现关闭键盘 scrollView: UIScrollView! title_textField: UITextField! let hideKeyboardTapGesture = UI ...

  4. 前端切图|点击按钮div变色

    <!DOCTYPE html> <html> <head> <title>点击按钮div变色.html</title> <meta c ...

  5. 点击一个div隐藏另一个div

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. 如何设计点击点击一个div,其他div做出对应反应,以及获取一个节点下的子节点

    <div id="show"> <div>1</div> <div>2</div> <div>3</d ...

  7. javascript小练习—点击将DIV变成红色(通过for循环遍历)

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  8. jquery点击非div区域隐藏div

    点击非div区域隐藏div,如图,点击圆的头像(.person-msg)弹出白色底框(.person-centre).点击圆头像以外的区域隐藏白色底框

  9. jquery实现点击控制div的显示和隐藏

    我们使用点击显示.点击隐藏的时候,一般有两种可选方案 .示例 html <div class="index"> <h1> 首页 </h1> &l ...

随机推荐

  1. Yii 1.11 获取当前的模块名 控制器名 方法名

    $this->module->id; #模块名$this->action->id; #方法名$this->uniqueId; #控制器名称 Yii: 获取当前模块名.控制 ...

  2. How to Keep Alive SSH Sessions

    How to Keep Alive SSH Sessions Many NAT firewalls time out idle sessions after a certain period of t ...

  3. 编译python3

    安装环境 yum install gcc yum install zlib-devel yum install make 下载python版本 wget http://www.python.org/f ...

  4. <转>Linux环境进程间通信(三)

    原文链接:http://www.ibm.com/developerworks/cn/linux/l-ipc/part3/index.html 原文内容: 消息队列(也叫做报文队列)能够克服早期unix ...

  5. UVALive 7077 - Little Zu Chongzhi's Triangles(暴力)

    https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_probl ...

  6. LeetCode104: Maximum Depth of Binary Tree

    Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the long ...

  7. Javascript中的数据类型之旅

    虽然Javascript是弱类型语言,但是,它也有自己的几种数据类型,分别是:Number.String.Boolean.Object.Udefined.Null.其中,Object属于复杂数据类型, ...

  8. class str

    class str(object): """ str(object='') -> str str(bytes_or_buffer[, encoding[, erro ...

  9. 使用timer8秒读取一次方法进行操作

    public void TestofTimer() { System.Timers.Timer tt = new System.Timers.Timer(); //获取或设置引发 Elapsed 事件 ...

  10. How Tomcat Works(八)

    下面接着分析Context容器,该接口最重要的方法是addWrapper()方法与creatWrapper()方法,添加具体的子容器,这里是Wrapper容器实例 这里要分析的是一个简单的Contex ...