const $ = jQuery; $( function() { $( '.form-field input[type="password"]' ).wrap( '' ); $( '.lp-password-input' ).append( '' ); $( '.lp-show-password-input' ).on( 'click', function() { $( this ).toggleClass( 'display-password' ); if ( $( this ).hasClass( 'display-password' ) ) { $( this ).siblings( [ 'input[type="password"]' ] ).prop( 'type', 'text' ); } else { $( this ).siblings( 'input[type="text"]' ).prop( 'type', 'password' ); } } ); } );