Created
March 27, 2017 07:42
-
-
Save Origame/a172e195d07b1553d15db677eec1c66c to your computer and use it in GitHub Desktop.
JS - toggle encrypted password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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