From 162dbf74e0dcbd1771510d80316880137bdb4ee9 Mon Sep 17 00:00:00 2001 From: billz Date: Fri, 24 Mar 2023 12:02:50 +0100 Subject: [PATCH] Update js-toggle-password w/ fontawesome glyphs --- app/js/custom.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/js/custom.js b/app/js/custom.js index 1412b44f..3bae9432 100644 --- a/app/js/custom.js +++ b/app/js/custom.js @@ -480,18 +480,18 @@ Array.range = (start, end) => Array.from({length: (end - start)}, (v, k) => k + $(document).on("click", ".js-toggle-password", function(e) { var button = $(e.target) var field = $(button.data("target")); + if (field.is(":input")) { e.preventDefault(); if (!button.data("__toggle-with-initial")) { - button.data("__toggle-with-initial", button.text()) + $("i", this).removeClass("fas fa-eye").addClass(button.attr("data-toggle-with")); } if (field.attr("type") === "password") { - button.text(button.data("toggle-with")); field.attr("type", "text"); } else { - button.text(button.data("__toggle-with-initial")); + $("i", this).removeClass("fas fa-eye-slash").addClass("fas fa-eye"); field.attr("type", "password"); } }