-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
23 lines (17 loc) · 689 Bytes
/
Copy pathapp.js
File metadata and controls
23 lines (17 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const search = () => {
const searchbox = document.getElementById("search-user").value.toUpperCase();
const storeusers = document.getElementById("user-list")
const user = document.querySelectorAll(".user")
const uname = storeusers.getElementsByTagName("h2")
for(var i=0; i < uname.length; i++){
let match = user[i].getElementsByTagName("h2")[0];
if(match){
let textvalue = match.textContent || match.innerHTML
if(textvalue.toLocaleUpperCase().indexOf(searchbox) > -1){
user[i].style.display = "";
} else {
user[i].style.display = "none";
}
}
}
}