Reputation: 149
I'm trying to test for something's visibility with
$(this).css('display')=="none";
The problem is, it works in chrome, FF...but not in IE. I've tried IE 8 and 9 so far.
Does anyone know a work around? This is very frustrating as a bunch of people still use IE and I don't want to lose that bunch of people.
Upvotes: 0
Views: 1459
Reputation: 16961
Use $(this).is(":visible")
for a cross-browser solution.
From the docs:
Elements are considered visible if they consume space in the document. Visible elements have a width or height that is greater than zero.
Elements with visibility: hidden or opacity: 0 are considered visible, since they still consume space in the layout.
Read more: http://api.jquery.com/visible-selector/ and How to tell if an element is visible
Upvotes: 7