views:

21

answers:

2

Hi All,

I have a div that contains many spans and each of those spans contains a single href.

Basically it's a tag cloud. I have a textbox with a keyup event that filters the tag cloud div (It actually just hides the tags if not in filter condition).

Is there a way to get a count of the tags shown as the keyup event occurs?

Thanks, rodchar

+1  A: 
$("#filter_input").keyup( function() {
    count = $("#cloud span:visible").size();
    // Do something with the counted spans.
});

That should do it, substitute values as needed.

Zack
you was a little bit faster ;-)
SQueek
And doesn't require a class on the a tag, too =o
Zack
+1  A: 

jquery size() Returns the number of matched elements.

$('.tags span a.visible').size();

SQueek