Files
anomaly-front-stats/static/filterTable.js
T
IM23a-bachmannj2 c51e60ed05 1st commit
2024-09-11 12:32:01 +02:00

18 lines
610 B
JavaScript

function filterTable() {
const input = document.getElementById('search');
const filter = input.value.toLowerCase();
const table = document.getElementById('gun-stats');
const tr = table.getElementsByTagName('tr');
for (let i = 1; i < tr.length; i++) {
const td = tr[i].getElementsByTagName('td')[1];
if (td) {
const txtValue = td.textContent || td.innerText;
if (txtValue.toLowerCase().indexOf(filter) > -1) {
tr[i].style.display = '';
} else {
tr[i].style.display = 'none';
}
}
}
}