Home  >  Article  >  php教程  >  Click on other hidden divs

Click on other hidden divs

WBOY
WBOYOriginal
2016-07-06 13:29:232143browse

Click elsewhere to hide a specific div
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script><br>     <div id="b" style="display:none;width:100px;height:100px;background:#ccc;">收尾</div><br>     <a href="#" id="show">点击显示</a><br>     <script><br>         $b = $("#b");<br>         $("#show").on({<br>             "click": function(){<br>                 $b.toggle();<br>                 return false;<br>             }<br>         });<br>         $(document).on({<br>             "click": function(e){<br>                 var src = e.target;<br>  <br>                 if(src.id && src.id ==="b"){<br>                     return false;<br>                 }else{<br>                     $b.hide();<br>                 }<br>             }<br>         });<br>     </script>

Yunqi Conference Beijing Station: It’s rare for Alibaba technical experts to make an appearance. More than 100 people came this time? !

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn