Wrap layer selection in labels so clicking text checks box
This commit is contained in:
parent
bacab31bbc
commit
4167fed59c
2
main.js
2
main.js
|
@ -32,7 +32,7 @@ for (let category of layerCategories) {
|
||||||
for (let layer of category.layers) {
|
for (let layer of category.layers) {
|
||||||
const li = document.createElement("li");
|
const li = document.createElement("li");
|
||||||
li.innerHTML = `
|
li.innerHTML = `
|
||||||
<input type="checkbox" ${layer.enabled ? "checked" : ""}> ${layer.name}
|
<label><input type="checkbox" ${layer.enabled ? "checked" : ""}> ${layer.name}</label>
|
||||||
`;
|
`;
|
||||||
li.querySelector("input").addEventListener("change", function(e){
|
li.querySelector("input").addEventListener("change", function(e){
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
|
|
Loading…
Reference in a new issue