Drupal investigation

main.js 848B

12345678910111213141516171819202122232425262728
  1. function searchFunc() {
  2. var input, filter, table, tr, td, i;
  3. input = document.getElementById("filter-input");
  4. filter = input.value.toLowerCase();
  5. console.log(filter);
  6. table = document.getElementsByTagName("tbody")[0];
  7. console.log(table);
  8. tablerow = table.getElementsByTagName("tr");
  9. console.log(tablerow);
  10. // Loop through all table rows, and hide those who don't match the search query
  11. for (i = 0; i < tablerow.length; i++) {
  12. td = tablerow[i].getElementsByTagName("td")[2];
  13. console.log(td);
  14. label = td.getElementsByTagName("label")[0].innerText;
  15. if (label) {
  16. if (label.toLowerCase().indexOf(filter) > -1) {
  17. tablerow[i].style.display = "";
  18. } else {
  19. tablerow[i].style.display = "none";
  20. }
  21. }
  22. }
  23. }