function filter_name(str) { if (str.length == 0) { for (let i = 0; i < articles.length; i++) { articles[i].style.display = "block"; } } else { str = str.toLowerCase(); for (let i = 0; i < articles.length; i++) { articles[i].style.display = !articles[i].dataset.title.includes(str) ? "none" : "block"; } } } let articles = document.getElementsByTagName("article"); let search = document.getElementById("search"); search.style.display = "inline-block";