Attempt to implement checkbox shitter
This commit is contained in:
parent
0f2400435f
commit
4aa09ce502
6 changed files with 143 additions and 13 deletions
|
|
@ -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}}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue