Advertisement
palsushobhan

Passowrd visibility icon on vendor registration page

Jun 29th, 2024
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. add_action('wcfm_membership_registration_form_after_dynamic_custom_fields', function () {
  2.     ?>
  3.     <style>
  4.         div#wcfm_membership_registration_form_expander {
  5.             position: relative;
  6.         }
  7.         div#wcfm_membership_registration_form_expander span.password-visibility {
  8.             position: absolute;
  9.             right: 20px;
  10.             margin-top: 8px;
  11.         }
  12.     </style>
  13.     <?php
  14. });
  15.  
  16. add_action('end_wcfm_membership_registration_form', function () {
  17.     ?>
  18.     <script>
  19.     jQuery(function($) {
  20.         $html = '<span class="wcfmfa fa-eye text_tip password-visibility"></span>';
  21.         $('#wcfm_membership_registration_form input[type="password"').after($html);
  22.         $('#wcfm_membership_registration_form').on('click', 'span.password-visibility', function(e) {
  23.             $pass_input = $(this).prev('input');
  24.             if($(this).hasClass('fa-eye-slash')) {
  25.                 $pass_input[0].type = 'password';
  26.                 $(this).removeClass('fa-eye-slash');
  27.                 $(this).addClass('fa-eye');
  28.             } else {
  29.                 $pass_input[0].type = 'text';
  30.                 $(this).removeClass('fa-eye');
  31.                 $(this).addClass('fa-eye-slash');
  32.             }
  33.         });
  34.     });
  35.     </script>
  36.     <?php
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement