1+ <script type="text/javascript">
2+ require(['jquery', 'jquery/ui'], function($){
3+     jQuery("#password").before('<span toggle="#password" class="toggle-password"><img src="<?=  $ this getViewFileUrl ("Navigate_PasswordHideShow::images/eye.png " ); ?> " class="eye-open" /><img src="<?=  $ this getViewFileUrl ("Navigate_PasswordHideShow::images/eye-slash.png " ); ?> " class="eye-close" style="display: none;"/></span>');
4+     jQuery("#password-confirmation").before('<span toggle="#password-confirmation" class="toggle-password-confirmation"><img src="<?=  $ this getViewFileUrl ("Navigate_PasswordHideShow::images/eye.png " ); ?> " class="eye-open-confirmation" /><img src="<?=  $ this getViewFileUrl ("Navigate_PasswordHideShow::images/eye-slash.png " ); ?> " class="eye-close-confirmation" style="display: none;"/></span>');
5+     jQuery("body").on('click', '.toggle-password', function() {
6+         var input = jQuery("#password");
7+         if (input.attr("type") === "password") {
8+             input.attr("type", "text");
9+             jQuery(".eye-close").show();
10+             jQuery(".eye-open").hide();
11+         } else {
12+             jQuery(".eye-close").hide();
13+             jQuery(".eye-open").show();
14+             input.attr("type", "password");
15+         }
16+     });
17+     jQuery("body").on('click', '.toggle-password-confirmation', function() {
18+         var input = jQuery("#password-confirmation");
19+         if (input.attr("type") === "password") {
20+             input.attr("type", "text");
21+             jQuery(".eye-close-confirmation").show();
22+             jQuery(".eye-open-confirmation").hide();
23+         } else {
24+             jQuery(".eye-close-confirmation").hide();
25+             jQuery(".eye-open-confirmation").show();
26+             input.attr("type", "password");
27+         }
28+     });
29+ });
30+ </script>
0 commit comments