Opened 10 years ago
Closed 10 years ago
#12473 closed bug (worksforme)
why in input tag<input id="test" style="visibility:hidden;"/> that $("#test").is(":hidden") result is not right?
Reported by: | 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>
Change History (2)
comment:1 Changed 10 years ago by
comment:2 Changed 10 years ago by
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>
</script> </body>