function updateFilter(min, max) {
// As you use jQuery, use it to its ful potential:
$(‘#historyTable > tbody > tr > td:nth-child(4)’).each(function() {
// Don’t retrieve HTML but text; convert to number with `+`
var scoreCheck = +$(this).text();
// Toggle instead of hide, so it works both ways:
// Don’t select providing HTML, but use a TR selector.
$(this).closest(‘tr’).toggle(min <= scoreCheck && scoreCheck <= max);
});
}
$('#filter').click(function () {
var min = +$('#min').val(); // invalid input will use 0 as minimum
// Replace invalid max input with very high value, so everything will be shown
var max = +$('#max').val() || 1e20;
updateFilter(min, max);
});
th, td { border-bottom: 1px solid #ddd;}
tr:hover {background-color: #f5f5f5}
table {font-size: 11px}
Game # | Date | Location | Score | Strikes | Spares |
---|---|---|---|---|---|
299 | 29 Feb 2016 | Hello World Bowling Alley | 202 | 6 | 1 |
298 | 13 March 2016 | Kuwait Open | 158 | 5 | 2 |
297 | 13 Oct 2015 | 11th Columbia 300 Vienna Open | 213 | 7 | 1 |
296 | 20 Mar 2016 | Brunswick Euro Challenge | 259 | 3 | 2 |
Min:
Max: