17 lines
609 B
JavaScript
17 lines
609 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';
|
|
}
|
|
}
|
|
}
|
|
} |