Skip to content

Instantly share code, notes, and snippets.

@Origame
Created March 27, 2017 07:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Origame/a172e195d07b1553d15db677eec1c66c to your computer and use it in GitHub Desktop.
Save Origame/a172e195d07b1553d15db677eec1c66c to your computer and use it in GitHub Desktop.
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