Searching Stack Overflow I was able to filter rows in real time, but I need to be more specific. Right now I'm using this code:
HTML:
<input type="text" id="search" placeholder="Write here to filter">
Script:
$(document).ready(function(){
var $rows = $('#catalogo tbody tr');
$rows.splice(0,1);
$('#search').keyup(function() {
var val = $.trim($(this).val()).replace(/ +/g, ' ').toLowerCase().split(' ');
$rows.hide().filter(function() {
var text = $(this).text().replace(/\s+/g, ' ').toLowerCase();
var matchesSearch = true;
$(val).each(function(index, value) {
matchesSearch = (!matchesSearch) ? false : ~text.indexOf(value);
});
return matchesSearch;
}).show();
});
});
Script based on this: How to perform a real time search and filter on a HTML table
What I would like to do is be able to have 4 different inputs, each one filtering first, second, third and fourth cells of each row (to be able to filter by title, author, year and max price). How could I acomplish this?