Skip to content

Instantly share code, notes, and snippets.

@rajitha-bandara
Created July 5, 2018 05:01
Show Gist options
  • Save rajitha-bandara/b47f70e11d38823263700fc3bb3b6935 to your computer and use it in GitHub Desktop.
Save rajitha-bandara/b47f70e11d38823263700fc3bb3b6935 to your computer and use it in GitHub Desktop.
function filter_by_project(){
var input, filter, table, tr, td, i;
input = $("#project_filter").val();
filter = input.toUpperCase();
table = document.getElementById("receivings_table");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[3];
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