aredn/files/app/partial/password-ctrl.ut

17 lines
431 B
Plaintext
Executable File

<script>
(function(){
function toggle()
{
const p = htmx.findAll("input.password-toggle");
const t = p[0].type === "text" ? "password" : "text";
for (let i = 0; i < p.length; i++) {
p[i].type = t;
}
}
const b = htmx.findAll("input.password-toggle + button.icon.eye");
for (let i = 0; i < b.length; i++) {
htmx.on(b[i], "click", toggle);
}
})();
</script>