2022-08-31 08:06:45 +04:00
|
|
|
const buttons = document.getElementsByTagName("button");
|
|
|
|
const articles = document.getElementsByTagName("article");
|
|
|
|
|
|
|
|
document.getElementById("filter").classList.remove("hidden");
|
|
|
|
|
|
|
|
for (let i = 0; i < buttons.length; ++i)
|
2022-08-31 08:29:31 +04:00
|
|
|
if (buttons[i].name !== "")
|
2022-08-31 08:06:45 +04:00
|
|
|
buttons[i].addEventListener("click", e => {
|
|
|
|
for (let j = 0; j < articles.length; ++j)
|
2022-09-19 22:01:40 +04:00
|
|
|
if (articles[j].id.startsWith(e.target.name) || e.target.name === "all")
|
2022-08-31 08:06:45 +04:00
|
|
|
articles[j].classList.remove("hidden");
|
|
|
|
else
|
|
|
|
articles[j].classList.add("hidden"); });
|