Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The <code>.is(":visible")</code> selector won't work in your code because, you are setting <code>visibility:hidden</code>. According to jQuery documentation on <a href="http://api.jquery.com/visible-selector/" rel="nofollow"><code>.is(":visible")</code></a></p> <blockquote> <p>Elements with <code>visibility: hidden</code> or <code>opacity: 0</code> are considered to be visible, since they still consume space in the layout. During animations that hide an element, the element is considered to be visible until the end of the animation. During animations to show an element, the element is considered to be visible at the start at the animation.</p> </blockquote> <hr/> <p>Working code snippet in jQuery</p> <pre><code>function ChooseProd(objID) { var $obj = $("#" + objID); var isVisible = $obj.css('visibility') != 'hidden'; var isDisplayed = $obj.is(':visible'); var alertText = (isVisible &amp;&amp; isDisplayed) ? "Visible element" : "Hidden Element"; alert(alertText); return false; } </code></pre> <p><hr/> Its better to set <code>display: none</code> which would save the code from checking the <em>visibility</em> property.<br> So, why don't you try using <code>display:none</code> instead?</p> <p>In short, you code will work, if you change <strike><code>img.Attributes.Add("style", "visibility:hidden");</code></strike> to <code>img.Attributes.Add("style", "display: none");</code> inside your <code>repTest_ItemDataBound</code></p> <p>Working Demo: <a href="http://jsfiddle.net/naveen/9zGXz/" rel="nofollow">http://jsfiddle.net/naveen/9zGXz/</a></p> <p>Another comprehensive demo(forked from @mu is too short): <a href="http://jsfiddle.net/naveen/dM6yR/" rel="nofollow">http://jsfiddle.net/naveen/dM6yR/</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload