|
86 | 86 | {% endblock %} |
87 | 87 |
|
88 | 88 | {% block javascript %} |
89 | | -<script> |
90 | | - document.querySelectorAll('.password-toggle').forEach(button => { |
91 | | - button.addEventListener('click', function () { |
92 | | - // Find the input that lives in the same group as this button |
93 | | - const input = this.parentElement.querySelector('.password-input'); |
94 | | - const iconShow = this.querySelector('.icon-show'); |
95 | | - const iconHide = this.querySelector('.icon-hide'); |
| 89 | +<script type="text/javascript"> |
| 90 | + function run() { |
| 91 | + live('.password-toggle', 'click', function (elem, event) { |
| 92 | + // Find the input that lives in the same group as this button |
| 93 | + const input = elem.parentElement.querySelector('.password-input'); |
| 94 | + const iconShow = elem.querySelector('.icon-show'); |
| 95 | + const iconHide = elem.querySelector('.icon-hide'); |
96 | 96 |
|
97 | | - if (input.getAttribute('type') === 'password') { |
98 | | - input.setAttribute('type', 'text'); |
99 | | - iconShow.style.display = 'none'; |
100 | | - iconHide.style.display = 'block'; |
101 | | - } else { |
102 | | - input.setAttribute('type', 'password'); |
103 | | - iconShow.style.display = 'block'; |
104 | | - iconHide.style.display = 'none'; |
105 | | - } |
106 | | - }); |
107 | | - }); |
| 97 | + if (input.getAttribute('type') === 'password') { |
| 98 | + input.setAttribute('type', 'text'); |
| 99 | + iconShow.style.display = 'none'; |
| 100 | + iconHide.style.display = 'block'; |
| 101 | + } else { |
| 102 | + input.setAttribute('type', 'password'); |
| 103 | + iconShow.style.display = 'block'; |
| 104 | + iconHide.style.display = 'none'; |
| 105 | + } |
| 106 | + }); |
| 107 | + } |
| 108 | +</script> |
108 | 109 | </script> |
109 | 110 | {% endblock %} |
0 commit comments