I used w3School code for my page and it works fine but it only filters one column, don’t know how create loops but hopping there is easier solution.
td =
Code that works for filtering multiple columns dynamically. No changes needed.
function myFunction(elem) {
var input, filter, table, tr, td, i, txtValue;
input = elem;
filter = input.value.toUpperCase();
table = document.getElementById("YourTableId");
tr = table.getElementsByTagName("tr");
for (i = 1; i < tr.length; i++) {
tds = tr[i].getElementsByTagName("td");
var matches = false;
for (j = 0; j < tds.length; j++) {
if (tds[j]) {
txtValue = tds[j].textContent || tds[j].innerText;
if (txtValue.toUpperCase().indexOf(filter) > -1) {
matches = true;
}
}
}
if(matches == true)
{
tr[i].style.display = "";
}
else {
tr[i].style.display = "none";
}
}
}