javascript - Trouble getting count of table rows that contain certain text -
i trying output count of table rows contain text label.
when step through javascript, count variable contains count, ends value of undefined when stepping next line.
var lblpending = document.getelementbyid("lblpending"); var count = $("#match-table tr").filter(function() { return $.text([this]) === 'pending credit'; }).length; if (count > 0) { lblpending.innerhtml = count + " pending"; } else { $("#lblpending").hide(); }
is return causing that?
something this(using contains
):
$(function(){ var myrows = $("#match-table tr:contains('pending credit')"); $("#result").html(myrows.length + " pending"); });
Comments
Post a Comment