mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-05-19 10:32:56 +00:00
fixed updating checkbox value
This commit is contained in:
parent
2aeef79a0f
commit
d3e405c35c
2 changed files with 8 additions and 3 deletions
|
@ -22,9 +22,14 @@ function writeDataToInput(data) {
|
||||||
console.log("write data", typeof data);
|
console.log("write data", typeof data);
|
||||||
for (const [key, value] of Object.entries(data)) {
|
for (const [key, value] of Object.entries(data)) {
|
||||||
const element = document.querySelector(`[name=${key}]`);
|
const element = document.querySelector(`[name=${key}]`);
|
||||||
console.log(element);
|
console.log(key, element);
|
||||||
|
|
||||||
|
if (element.type === "checkbox") {
|
||||||
|
element.checked = value;
|
||||||
|
} else {
|
||||||
element.value = value;
|
element.value = value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// send "change" event
|
// send "change" event
|
||||||
form.dispatchEvent(new Event("change", { bubbles: true }));
|
form.dispatchEvent(new Event("change", { bubbles: true }));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue