-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (25 loc) · 875 Bytes
/
script.js
File metadata and controls
25 lines (25 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const input = document.querySelectorAll('input');
const tr = document.querySelectorAll('table tbody tr');
input.forEach((searchInput, index) => {
searchInput.addEventListener('input', () => {
tr.forEach(item => {
if (index === 0) {
if (item.innerText.toLowerCase().includes(searchInput.value)) {
item.classList.remove('d-none');
} else {
item.classList.add('d-none');
}
} else {
if (
item.children[index - 1].innerText
.toLowerCase()
.includes(searchInput.value)
) {
item.classList.remove('d-none');
} else {
item.classList.add('d-none');
}
}
});
});
});