12 lines
365 B
JavaScript
Executable File
12 lines
365 B
JavaScript
Executable File
const articles = document.getElementsByTagName("article");
|
|
|
|
document.getElementById("filter").classList.remove("hidden");
|
|
|
|
function filter(e) {
|
|
for (const a of articles)
|
|
a.classList.toggle("hidden",
|
|
!(e.target.name === "all" || a.id.startsWith(e.target.name)));
|
|
}
|
|
|
|
for (const b of document.getElementsByTagName("button"))
|
|
b.addEventListener("click", filter); |