Change event listener init
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
function filter_name(str)
|
||||
function filter_title(str)
|
||||
{
|
||||
if (str.length == 0) {
|
||||
articles.forEach(article => article.style.display = "block");
|
||||
@ -7,5 +7,9 @@ function filter_name(str)
|
||||
}
|
||||
}
|
||||
|
||||
const search = document.querySelector("input[type='search']");
|
||||
const form = document.querySelector("form");
|
||||
let articles = Array.from(document.querySelectorAll("article"));
|
||||
document.querySelector("#search").style.display = "inline-block";
|
||||
|
||||
search.addEventListener("input", () => filter_title(search.value));
|
||||
window.addEventListener("load", () => search.style.display = "inline-block");
|
||||
|
Reference in New Issue
Block a user