<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>element visibility &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/element-visibility/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>jQuery check for element visibility</title>
		<link>/2009/07/08/jquery-check-for-element-visibility/</link>
		<comments>/2009/07/08/jquery-check-for-element-visibility/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 06:34:11 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[element visibility]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">/?p=661</guid>
		<description><![CDATA[What if the element exists in the DOM That was described in my recent post and it describes the case when you have a particular element in the DOM tree, or if that element does not exists. example: &#60;div id="holder"&#62; &#60;div id="element_id"&#62;Hello World!&#60;/div&#62; &#60;/div&#62; console.log( $('#element_id').length ) this prints 1, because the element exists. In &#8230; <a href="/2009/07/08/jquery-check-for-element-visibility/" class="more-link">Continue reading <span class="screen-reader-text">jQuery check for element visibility</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/07/04/jquery-check-for-element-existence-in-the-dom/" rel="bookmark" title="jquery check for element existence in the DOM">jquery check for element existence in the DOM </a></li>
<li><a href="/2009/11/30/toggle-the-visibility-with-jquery/" rel="bookmark" title="Toggle the visibility with jQuery">Toggle the visibility with jQuery </a></li>
<li><a href="/2009/07/29/cancel-bubbling-on-element-click-with-jquery/" rel="bookmark" title="cancel bubbling on element click with jQuery">cancel bubbling on element click with jQuery </a></li>
<li><a href="/2009/07/09/jquery-datepicker-persist-defaultdate/" rel="bookmark" title="jQuery datepicker persist defaultDate">jQuery datepicker persist defaultDate </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>What if the element exists in the DOM</h2>
<p>That was described in my recent <a title="jQuery check for element existence in the DOM" href="/2009/07/04/jquery-check-for-element-existence-in-the-dom/" target="_self">post</a> and it describes the case when you have a particular element in the DOM tree, or if that element does not exists.</p>
<p><strong>example:</strong></p>
<pre lang="html4strict" escaped="true">
&lt;div id="holder"&gt;
&lt;div id="element_id"&gt;Hello World!&lt;/div&gt;
&lt;/div&gt;
</pre>
<pre lang="javascript">
console.log( $('#element_id').length )
</pre>
<p>this prints 1, because the element exists. In the following example is different.<span id="more-661"></span></p>
<p><strong>example:</strong></p>
<pre lang="html4strict" escaped="true">
&lt;div id="holder"&gt;
&lt;/div&gt;
</pre>
<pre lang="javascript">
console.log( $('#element_id').length )</pre>
<p>that returns 0, because obviously the element does not exists.</p>
<h2>So far so good, but what if the element exists and it&#8217;s not visible</h2>
<p>Well than the HTML look like that:</p>
<p><strong>example:</strong></p>
<pre lang="html4strict" escaped="true">&lt;div id="holder"&gt;
  &lt;div id="element_id" style="display:none"&gt;
    Hello World!
  &lt;/div&gt;
&lt;/div&gt;</pre>
<p>The solution is a bit different, but simple</p>
<p><strong>jQuery code:</strong></p>
<pre lang="javascript" escaped="true">    if ($('#element_id:visible').length &gt; 0)
         console.log('the element is visible');
    else
         console.log('the element is not visible');</pre>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/07/04/jquery-check-for-element-existence-in-the-dom/" rel="bookmark" title="jquery check for element existence in the DOM">jquery check for element existence in the DOM </a></li>
<li><a href="/2009/11/30/toggle-the-visibility-with-jquery/" rel="bookmark" title="Toggle the visibility with jQuery">Toggle the visibility with jQuery </a></li>
<li><a href="/2009/07/29/cancel-bubbling-on-element-click-with-jquery/" rel="bookmark" title="cancel bubbling on element click with jQuery">cancel bubbling on element click with jQuery </a></li>
<li><a href="/2009/07/09/jquery-datepicker-persist-defaultdate/" rel="bookmark" title="jQuery datepicker persist defaultDate">jQuery datepicker persist defaultDate </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/07/08/jquery-check-for-element-visibility/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
