hasAttribute() works not like I thought. Here just a comparison with a string is needed.
This commit is contained in:
parent
778363312a
commit
6f45549b73
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user