Skip to content

Instantly share code, notes, and snippets.

@RuanAragao
Created August 26, 2013 16:20
Show Gist options
  • Save RuanAragao/6343374 to your computer and use it in GitHub Desktop.
Save RuanAragao/6343374 to your computer and use it in GitHub Desktop.
Password Form Preview jQuery
<!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>
$(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