I’m using a script that I found to search in my table and show only the rows that contains the rows which matches the text in the search input field.
$("#searchfahrzeuge").keyup(function(){
$("#fahrzeugliste").find("tr").hide();
var data = this.value.split(" ");
var jo = $("#fahrzeugliste").find("tr");
$.each(data, function(i, v){
jo = jo.filter("*:containsIgnoreCase('"+v+"')");
console.log(jo);
});
jo.show(); });
But now I want to exclude two columns of the table, they have both have a class “.nosearch”,
but I don’t know how do to this…
I tried:
var jo = $("#fahrzeugliste").find("tr:not(.nosearch)");
and also in the filter function:
jo = jo.filter("*:not(.nosearch):containsIgnoreCase('"+v+"')");
but both doesn’t work.
You didn’t provide your html, but I assume the class is on the
td. This is your problem, the filtering is all done at thetrlevel so the:notis applying to thetr, which does not have the class.I would change it to filter on the
tds rather than thetrelements. Something like this (untested):