dynamic tag count on keyup
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 k开发者_如何学Goeyup event occurs?
Thanks, rodchar
$("#filter_input").keyup( function() {
count = $("#cloud span:visible").size();
// Do something with the counted spans.
});
That should do it, substitute values as needed.
jquery size() Returns the number of matched elements.
$('.tags span a.visible').size();
精彩评论