heroweb/poc/static/js/toggle.js
2024-09-02 07:28:06 +02:00

10 lines
327 B
JavaScript

text = document.querySelector("[profile-visibility-toggle-label]").firstElementChild;
toggler = document.querySelector("[profile-visibility-toggle]");
toggler.addEventListener("change", function () {
if (this.checked) {
text.innerText = "Switch to invisible";
} else {
text.innerText = "Switch to visible";
}
});