forked from minhaj-313/Facts-Website
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
19 lines (17 loc) · 745 Bytes
/
Copy pathscript.js
File metadata and controls
19 lines (17 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
function searchFN() {
var searchVal, wrapper, textDiv, text, searchInfo;
searchVal = document.getElementById('search').value;
searchInfo = document.getElementById("searchInfo");
wrapper = document.getElementsByClassName("wrapper");
for (i = 0; i < wrapper.length; i++) {
textDiv = wrapper[i].getElementsByTagName("p")[0];
text = textDiv.textContent || textDiv.innerText;
if (text.toUpperCase().indexOf(searchVal.toUpperCase()) > -1) {
wrapper[i].style.display = "";
} else {
wrapper[i].style.display = "none";
hero.style.height = "70vh";
}
searchInfo.innerHTML = "<h1 class='mb-4 px-5'> Search Results for : " + searchVal + "</h1>"
}
}