Attempt to implement checkbox shitter

This commit is contained in:
Maximilian Friedersdorff 2025-07-25 13:44:21 +01:00
parent 0f2400435f
commit 4aa09ce502
6 changed files with 143 additions and 13 deletions

View file

@ -7,5 +7,22 @@
<a class="btn btn-primary" href="{{.urlEdit}}">Edit</a>
<a class="btn btn-danger" href="{{.urlDelete}}">Delete</a>
</div>
{{end}}
<script>
let checkBoxes = document.querySelectorAll('input[type=checkbox]')
for (const i in checkBoxes) {
let box = checkBoxes[i]
box.disabled = false
box.onchange = function(event) {
let form = new FormData()
form.append("box", i)
fetch("togglebox/", {method: "POST", body: form}).then((response) => {
location.reload();
})
}
}
</script>
{{end}}