mirror of
https://github.com/Theodor-Springmann-Stiftung/musenalm.git
synced 2025-10-29 09:15:33 +00:00
18 lines
529 B
Plaintext
18 lines
529 B
Plaintext
<script type="module">
|
|
let fieldset = document.querySelector("fieldset.selectgroup");
|
|
let checkboxes = Array.from(fieldset.querySelectorAll('input[type="checkbox"]'));
|
|
fieldset.addEventListener("change", (event) => {
|
|
let target = event.target;
|
|
if (target.type === "checkbox") {
|
|
let name = target.name;
|
|
let checked = target.checked;
|
|
if (!checked) {
|
|
let allchecked = checkboxes.filter((checkbox) => checkbox.checked);
|
|
if (allchecked.length === 0) {
|
|
target.checked = true;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
</script>
|