mirror of
https://github.com/hnasheralneam/hnasheralneam.github.io.git
synced 2024-11-07 08:05:54 -05:00
11 lines
445 B
JavaScript
11 lines
445 B
JavaScript
const data = document.getElementsByClassName("weather");
|
|
document.querySelector(".search-bar").addEventListener("input", (event) => {
|
|
let userQuery = document.querySelector(".search-bar").value;
|
|
for (i = 0; i < data.length; i++) {
|
|
console.log(data[i].classList);
|
|
if (data[i].classList.contains(userQuery.toLowerCase())) {
|
|
data[i].style.display = "grid";
|
|
}
|
|
else { data[i].style.display = "none"; }
|
|
}
|
|
});
|