I have a parent with li's, and given the pointer to a li, I want to get it's position as a child.
For this I used:
li.index()
Now... I have one more condition, it should find an index only among these children that have display:block property in css.
I tried it some other ways around but I was unable to solve it. Do have any ideas?
Edit: PS: or, rather for these that do not have display:none property.
EDIT 2: Well I these all require the reference to parent or specific ids, but what if have only a pointer to a li, for example:
<ul>
<li>Foo</li>
<li>Bar</li>
<li>Fiz</li>
<li>Buz</li>
</ul>
li=$('li:nth-child(n)');
now, let's suppose I know only one variable, and I want it's index among these that don't have css display: none propery...
Solved This is what did it:
li.add(li.siblings()).filter(':visible').index( li );
Thanks for helping me out with great ideas and different approach. :)
li.filter(":visible").index()?