JQuery - :visible 不起作用
我有一个带有 id 的 div,其首选项存储在 .css 文件中。 div 隐藏在开头 (display:none
),当用户在表单中输入内容时,我用 $(elem).hide().fadeIn();< 显示 div /code> 一切正常。
我只是想检查一下,如果使用 ESC 键,div 是否可见。我用 if($(elem).is(':visible')
和 $('#suchergebnis').css('display') == 'block'
尝试过code>.
我回显了显示属性,即使 div 可见,它也始终显示“无”。
这是怎么回事?我该如何解决它?
I have a div with an id, whose preferences are stored in a .css file. The div is hidden in the beginning (display:none
) and when the user types something into a form I show the div with $(elem).hide().fadeIn();
and everything works okay.
I just want to check, in case the ESC key is used, whether the div is visible or not. I tried it with if($(elem).is(':visible')
and $('#suchergebnis').css('display') == 'block'
.
I echoed the display property and it always shows 'none' even when the div is visible.
How can this be and how can I solve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论