Fix: Show password toggle not working in checkout page

This commit is contained in:
Sagar Tamang 2020-04-25 21:10:11 +05:45
parent 968f7ddc5b
commit ab8ee194c8
1 changed files with 4 additions and 2 deletions

View File

@ -81,15 +81,17 @@ jQuery( function( $ ) {
// Show password visiblity hover icon on woocommerce forms
$( '.woocommerce form .woocommerce-Input[type="password"]' ).wrap( '<span class="password-input"></span>' );
// Add 'password-input' class to the password wrapper in checkout page.
$( '.woocommerce form input' ).filter(':password').parent('span').addClass('password-input');
$( '.password-input' ).append( '<span class="show-password-input"></span>' );
$( '.show-password-input' ).click(
function() {
$( this ).toggleClass( 'display-password' );
if ( $( this ).hasClass( 'display-password' ) ) {
$( this ).siblings( ['input[name^="password"]', 'input[type="password"]'] ).prop( 'type', 'text' );
$( this ).siblings( ['input[type="password"]'] ).prop( 'type', 'text' );
} else {
$( this ).siblings( 'input[name^="password"]' ).prop( 'type', 'password' );
$( this ).siblings( 'input[type="text"]' ).prop( 'type', 'password' );
}
}
);