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-10-19 21:20:34 +04:00
|
|
|
if (buttons[i].name !== "")
|
|
|
|
buttons[i].addEventListener("click", e => {
|
|
|
|
for (let j = 0; j < articles.length; ++j)
|
|
|
|
if (articles[j].id.startsWith(e.target.name) || e.target.name === "all")
|
|
|
|
articles[j].classList.remove("hidden");
|
|
|
|
else
|
|
|
|
articles[j].classList.add("hidden"); });
|