jQuery: I need something like ':visible' that works even if the parent is display=none
- by Master Morality
I have a list where elements are hidden for multiple reasons, each corresponding to a css class i.e:
<style>
.filteredOut { display: none; }
.somethingElse { display : none; }
...
</style>
I want to apply alternating css classes via .filter(':even').addClass('even') but only to classes that are visible. The problem is that the parent is hidden when this happens so .filter(':visible') returns 0 elements. I need something like .filter(':visibileEventIfParentIsNot')
Further more, I'd rather not have to call a function with this in it every time I call a function that changes what's visible in a list. This may be a pipe dream, but is there a way to do this ala live() or something similar? I'm open to off the wall ideas.