From ec6f467fa22b294c01c1412fcb18bd9ff1ae61e1 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 1 Jul 2020 12:37:13 +0200 Subject: [PATCH] ui: Make Checkbox label click trigger checkbox toggle --- passbook/static/static/passbook/pf.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/passbook/static/static/passbook/pf.js b/passbook/static/static/passbook/pf.js index 9f634f3bc..3e0a31645 100644 --- a/passbook/static/static/passbook/pf.js +++ b/passbook/static/static/passbook/pf.js @@ -22,6 +22,14 @@ document.querySelectorAll(".pf-c-modal-box [data-modal-close]").forEach((b) => { }); }); +// Make Checkbox label click trigger checkbox toggle +document.querySelectorAll(".pf-c-check__label").forEach((checkLabel) => { + checkLabel.addEventListener("click", (e) => { + const checkbox = e.target.parentElement.querySelector("input[type=checkbox]"); + checkbox.checked = !checkbox.checked; + }); +}); + // CodeMirror document.querySelectorAll(".codemirror").forEach((cm) => { let cmMode = 'xml';