summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-09-10 18:48:01 +0200
committerJulian T <julian@jtle.dk>2020-09-10 18:48:01 +0200
commit0db7e0ea39b9a03fe401296517bb59360d7fbff8 (patch)
treea470241fecee5c8d7274dcd816b3a91578ec0b29
parent0935be04551ae744450809b63f72d330859e7f67 (diff)
Only filter when search is open
-rw-r--r--root.template13
1 files changed, 9 insertions, 4 deletions
diff --git a/root.template b/root.template
index 8cb65e8..e396d0e 100644
--- a/root.template
+++ b/root.template
@@ -28,6 +28,10 @@
:checked + #search-box {
display: block;
}
+
+ :checked ~ * .filtered {
+ display: none;
+ }
</style>
</head>
<body>
@@ -85,7 +89,7 @@
</form>
</div><br>
<label for="dosearch">Vis søg</label>
- <input type="checkbox" id="doseach">
+ <input type="checkbox" id="dosearch">
<div id="search-box">
<label for="search">Filter: </label>
<input type="input" id="search">
@@ -122,15 +126,16 @@
}
if (row.textContent.indexOf(value) > -1) {
- row.style.display = "";
+ row.classList.remove("filtered");
} else {
- row.style.display = "none";
+ row.classList.add("filtered");
}
}
status.textContent = "done";
}
- e = document.getElementById("search");
+
+ var e = document.getElementById("search");
e.addEventListener("change", inputchange);
e.addEventListener("keyup", inputchange);
</script>