hasAttribute() works not like I thought. Here just a comparison with a string is needed.

This commit is contained in:
Alexander Andreev 2022-08-31 08:29:31 +04:00
parent 778363312a
commit 6f45549b73
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -6,7 +6,7 @@ const articles = document.getElementsByTagName("article");
document.getElementById("filter").classList.remove("hidden");
for (let i = 0; i < buttons.length; ++i)
if (buttons[i].hasAttribute("name"))
if (buttons[i].name !== "")
buttons[i].addEventListener("click", e => {
const category = e.target.name;
for (let j = 0; j < articles.length; ++j)