12345678910111213141516171819202122232425262728 |
- function searchFunc() {
- var input, filter, table, tr, td, i;
- input = document.getElementById("filter-input");
- filter = input.value.toLowerCase();
- console.log(filter);
- table = document.getElementsByTagName("tbody")[0];
- console.log(table);
- tablerow = table.getElementsByTagName("tr");
- console.log(tablerow);
- // Loop through all table rows, and hide those who don't match the search query
- for (i = 0; i < tablerow.length; i++) {
- td = tablerow[i].getElementsByTagName("td")[2];
- console.log(td);
- label = td.getElementsByTagName("label")[0].innerText;
- if (label) {
- if (label.toLowerCase().indexOf(filter) > -1) {
- tablerow[i].style.display = "";
- } else {
- tablerow[i].style.display = "none";
- }
- }
- }
- }
|