Home  >  Article  >  Web Front-end  >  jQuery 判断元素是否隐藏的方法

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

WBOY
WBOYOriginal
2016-06-01 09:54:47969browse
<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>

在线运行

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