C# – JQuery and invisible select – JQuery


I have a select checkbox that has invisible set to false. ASPX looks like this:

<input name="selGR" id="selGR" type="checkbox" checked="checked" visible="false" runat="server" fieldname="GR"/>

The select box is not even rendered in the HTML which explains why JQuery is not finding it. Is there a way around this?

Setting style works! Thanks. I am curious to know if there are any rules the .NET framework follows when rendering controls with visible="false"? For all controls irrespective of whether they are server, custom or html controls, it follows this rule?
Also, any side effects of setting the style instead of setting the property of visible?

Best Solution

you can always set the display property to none. jQuery will be able to find it at that point.

<input type="checkbox" id="selGr" style="display:none" />

For future reference as well. $("#selGr").hide() & $("#selGr").show() basically uses the display property of the element.

I do not believe an 'visible' is an attribute of an element. There is visibility and display that can be set within the style attribute though. For a better understand of the difference between visibility and hidden check this out: http://www.devx.com/tips/Tip/13638