Tuesday, 13 August 2013

Count the number of displayed elements in a HTML list

Count the number of displayed elements in a HTML list

I have a list of list items which are display: none by default. I
programmatically change a certain number of them to list-items.
I've been trying to use querySelectorAll but when I try:
document.querySelectorAll("#ulname style[display*='list-item']")
it returns an empty array (I know it is at least one).
Ideas on how to modify my selectors or another approach? I would like to
know after the fact how many items are displayed.

No comments:

Post a Comment