如何隐藏分区 [英] How to hide div

查看:118
本文介绍了如何隐藏分区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些脚本。


  1. 要通过单击页面
  2. 在任何地方隐藏的div
  3. 要通过点击按钮,图像或特定的脚本
  4. 隐藏的div
  5. 要通过点击网页中的任何(当DIV包含任何其他脚本)隐藏一个div


我目前使用

\r
\r

<脚本>\r
    $(文件)。就绪(函数(){\r
\r
      $(#DIV)。点击(函数(){\r
\r
            。的document.getElementById('格')的style.display ='无';\r
\r
      });\r
\r
    });\r
    < / SCRIPT>

\r

\r
\r

这工作正常,为什么DIV包含图像,但它不工作时,DIV包含类似的广告脚本,如Chitika的广告,AdSense或脚本任何其他

请告诉该怎么办。


解决方案

试试这个使用这个这个选择是用来隐藏点击 DIV

  $(#DIV)。点击(函数(){
          $(本).hide();
      });

I need some script.

  1. To hide a div by clicking anywhere on the page
  2. To hide a div by clicking on button, images or particular script
  3. To hide a div by clicking anywhere on the page ( when div contain any other script)


I am currently using

<script>
    $(document).ready(function () {

      $("#div").click(function () {

            document.getElementById('div').style.display = 'none';

      });

    });
    </script>

This working fine why div contain images, but it not working when div contain script like advertisement script such as chitika, adsense or any other

Please tell how to do.

解决方案

Try this use this this selector is used to hide the clicked div

$("#div").click(function () {
          $(this).hide();
      });

这篇关于如何隐藏分区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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