Skip to main content

Bug Tracker

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 anonymous comment:1

<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>

Changed September 08, 2012 03:41PM UTC by mikesherov comment:2

component: unfiledcss
priority: undecidedlow
resolution: → worksforme
status: newclosed

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.