Reputation: 3602
I have an html document that has a 'status' column. I need to count how many of these are marked Available or not Available.
I've tried to do something like this
$("td:contains(Available)" ).length;
but this is also picking up the "Not Available"'s. Is there a way to only select the Available's?
A example of the web page http://www.cats-can.org/animals/list?Species=Cat
Upvotes: 0
Views: 41
Reputation: 64707
You could do:
$("td:contains(Available)" ).length - $("td:contains(Not Available)" ).length;
If the only text in the column is "Available", you could do:
$("td").filter(function() {
return $(this).text() === "Available";
}).length;
Upvotes: 1