Created
September 10, 2019 18:46
-
-
Save sudikrt/f517bbed466d1a36e5ccb40fac92b8aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function searchReport(searchInputId, searchTableId) | |
{ | |
var input, filter, table, tr, td, i; | |
input = document.getElementById(searchInputId); | |
filter = input.value.toUpperCase(); | |
table = document.getElementById(searchTableId); | |
tr = table.getElementsByTagName("tr"); | |
// Loop through all table rows, and hide those who don't match the search query | |
for (i = 0; i < tr.length; i++) { | |
td = tr[i].getElementsByTagName("td")[0]; | |
if (td) { | |
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { | |
tr[i].style.display = ""; | |
} else { | |
tr[i].style.display = "none"; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment