我如何能看到一种无形的控制与jQuery(隐藏和显示无法正常工作) [英] how can i visible an invisible control with jquery (hide and show not work)

查看:125
本文介绍了我如何能看到一种无形的控制与jQuery(隐藏和显示无法正常工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改使用jQuery控制的知名度?我有一个控制,它的可视属性设置为false。(不CSS)

How can I change the visibility of a control with jQuery? I have a control that its visible property to false...(not css)

当我用显示()它什么都没有发生作用,似乎隐藏()显示()方法是对CSS设置控件的,不可见的财产...

When I used show() function for it nothing happened, it seems that hide() and show() methods are for css set of a control , not visible property...

谢谢您的回答,

最好的问候

推荐答案

您不能使用jQuery做到这一点,可见=假在asp.net中表示控制的不会呈现到页面的。如果你想控制去到客户端,你需要做的风格=显示:无;所以它实际上是在HTML,否则有几乎一无所有客户端显示,由于该元素在你的服务器发送的HTML不是。

You can't do this with jQuery, visible="false" in asp.net means the control isn't rendered into the page. If you want the control to go to the client, you need to do style="display: none;" so it's actually in the HTML, otherwise there's literally nothing for the client to show, since the element wasn't in the HTML your server sent.

如果您删除可见属性,并添加风格属性,那么你可以使用jQuery来表现出来,就像这样的:

If you remove the visible attribute and add the style attribute you can then use jQuery to show it, like this:

$("#elementID").show();


旧的答案(前帕特里克捕获)

要修改能见度,你需要使用 。 CSS() ,像这样的:


Old Answer (before patrick's catch)

To change visibility, you need to use .css(), like this:

$("#elem").css('visibility', 'visible');

除非你需要,虽然有元素占据页面空间,可以使用显示:无; 而不是可见性:隐藏; 在你的CSS,那么就这样做:

Unless you need to have the element occupy page space though, use display: none; instead of visibility: hidden; in your CSS, then just do:

$("#elem").show();

.show() 和的 .hide() 功能处理显示而不是能见度,最喜欢的jQuery函数:)

The .show() and .hide() functions deal with display instead of visibility, like most of the jQuery functions :)

这篇关于我如何能看到一种无形的控制与jQuery(隐藏和显示无法正常工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆