Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JS - toggle encrypted password
var togglePasswordText = function(){
var $showBtn = $('.js-show-password');
var $pw = $('.js-password-toshow');
$showBtn.on('click', function(){
if ( $pw.get(0).type === "password" ){
$pw.get(0).type = 'text';
$showBtn.addClass('active');
}
else{
$pw.get(0).type = 'password';
$showBtn.removeClass('active');
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.