webseite/js/script.js
2025-04-01 16:04:02 +02:00

18 lines
No EOL
680 B
JavaScript

function prsearch() {
// Declare variables
var input, filter, ul, li, a, i;
input = document.getElementById("prsearch");
filter = input.value.toUpperCase();
ul = document.getElementById("products");
li = ul.getElementsByTagName("li");
// Loop through all list items, and hide those who don't match the search query
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName("h4")[0];
if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}