I have got a table , and also a filter for Quantity column
My requirement is that , i want to display only the contents that are greater than the entered in the filter quanity column
This is my logic :
$(document).ready(function () {
(function ($) {
$('#filter').keyup(function () {
var rex = new RegExp($(this).val(), 'i');
$('#myTable tr').hide();
$('#myTable td:eq(2)').filter(function () {
return rex.test($(this).text());
}).show();
})
}(jQuery));
});
You can do it like following.
$('#filter').keyup(function() {
var quantiy = +$(this).val(); //+ to convert string to number
var tr = $('#myTable tbody tr');
tr.hide();
tr.filter(function() {
return +$('td:eq(3)', this).text() > quantiy; //select quantity column by '$('td:eq(3)', this)'
}).show();
});