Home > Web Front-end > JS Tutorial > body text

jQuery 判断元素是否隐藏的方法

WBOY
Release: 2016-06-01 09:54:47
Original
967 people have browsed it
<code class="language-html">


<title>jQuery 判断元素是否隐藏的方法</title>
<style type="text/css">
#thediv{
  width:100px;
  height:100px;
  display:none;
}
</style>
<script type="text/javascript" src="/Public/js/jquery-1.7.1.min.js"></script> 
<script type="text/javascript">
$(document).ready(function(){
  if($("#thediv").is(":visible")==false){
    $("#show").text("处于隐藏状态");
  } 
  else{ 
    $("#show").text("处于显示状态");
  }
})
</script>


<div id="show"></div>
<div id="thediv">码农教程</div>

</code>
Copy after login

在线运行

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!