Side navigation
#12473 closed bug (worksforme)
Opened September 06, 2012 04:57AM UTC
Closed September 08, 2012 03:41PM UTC
why in input tag<input id="test" style="visibility:hidden;"/> that $("#test").is(":hidden") result is not right?
Reported by: | 赖扬文 785490650@qq.com | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | css | Version: | 1.4.4 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
<input id="test" style="visibility:hidden;"/>
<script>
$(function(){
var isVisible=$("#test").is(":visible");
var isHidden=$("#test").is(":hidden");
alert("isVisible:"+isVisible);should false ,but true, why?
alert("isHidden:"+isHidden);should true, but false,why?
if replace "input" to "div" that will been right
如果将input替换成div的话就不会有这样的bug
});
</script>
Attachments (0)
Change History (2)
Changed September 06, 2012 05:00AM UTC by comment:1
Changed September 08, 2012 03:41PM UTC by comment:2
component: | unfiled → css |
---|---|
priority: | undecided → low |
resolution: | → worksforme |
status: | new → closed |
Thanks for the report, but please ask for help on the forum!
The is(":visible") selector does not check for the "visibility" property, which just deals truly with opacity, but rather checks for the "display" property.
The reason it works for div and not input is that a div that has visibility hidden and no content truly has no dimensions and is therefore effectively hidden, but that is not true of inputs.
<input id="test" style="visibility:hidden;"/>
<script>
$(function(){
var isVisible=$("#test").is(":visible");
var isHidden=$("#test").is(":hidden");
alert("isVisible:"+isVisible);should false ,but true, why?
alert("isHidden:"+isHidden);should true, but false,why?
if replace "input" to "div" that will been right
如果将input替换成div的话就不会有这样的bug
});
</script>
</body>