Add option to toggle password fields (2) - Added spec
Change-Id: I67b542d5b1231b427f7b0be48fbe0ed2abde9498
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index eb41f35..98dc54a 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -440,7 +440,7 @@
/**
* Initialize password toggle.
*/
- initTogglePwdVisibility();
+ initTogglePwdVisibility(d);
/**
* Initialize Plugin registry.
diff --git a/dev/js/src/util.js b/dev/js/src/util.js
index b8be33b..14480bc 100644
--- a/dev/js/src/util.js
+++ b/dev/js/src/util.js
@@ -89,13 +89,13 @@
/**
* Add option to show passwords.
*/
-function initTogglePwdVisibility () {
- const el = document.querySelectorAll("input[type=password].show-pwd");
+function initTogglePwdVisibility (element) {
+ const el = element.querySelectorAll("input[type=password].show-pwd");
for (let x = 0; x < el.length; x++) {
const pwd = el[x];
const a = document.createElement('a');
- a.classList.add('showPWD');
+ a.classList.add('show-pwd');
a.addEventListener('click', function () {
if (pwd.getAttribute("type") === "password") {
pwd.setAttribute("type", "text");