-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
33 lines (29 loc) · 1.01 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function myFunction(z) {
var check, input, filter, cards, cardContainer, title, i;
input = document.getElementById("myFilter"+z);
filter = input.value.toUpperCase();
cardContainer = document.getElementById("myItems");
cards = cardContainer.getElementsByClassName("card");
for (i = 0; i < cards.length; i++) {
title = cards[i].outerText;
title = title.split("\n")
console.log(title)
check = true
for (var j=0; j<title.length; j++){
if(title[j].toUpperCase().includes(filter)){
cards[i].style.display = "";
check = false;
break;
}
}
if(check){
cards[i].style.display = "none";
}
}
}
mybutton = document.getElementById("myBtn");
// When the user clicks on the button, scroll to the top of the document
function topFunction() {
document.body.scrollTop = 0; // For Safari
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}