Created
August 26, 2013 16:20
-
-
Save RuanAragao/6343374 to your computer and use it in GitHub Desktop.
Password Form Preview jQuery
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-latest.js"></script> | |
<meta charset=utf-8 /> | |
<title>Pass</title> | |
</head> | |
<body> | |
<input type="password" id="input-pass" /><button id="btn-view">preview</button> | |
</body> | |
</html> |
This file contains 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
$(document).ready(function(){ | |
var passType = $("input-pass").attr("type"); | |
$("#btn-view").mousedown(function(){ | |
$('#input-pass').attr('type','text'); | |
}); | |
$("#btn-view").mouseup(function(){ | |
$('#input-pass').attr('type','password'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment