Monday, 10 March 2014

Javascript toggle password security field

A simple application in javascript to hide/show password field value in the password box


<script type="text/javascript" language="javascript">
function togglePassword() {
var upass = document.getElementById('upass');

var toggle_text = document.getElementById('test_toggle');
if(upass.type == "password"){
upass.type = "text";
toggle_text.innerHTML = "Hide Password Characters";
} else {
upass.type = "password";
toggle_text.innerHTML = "Show Password Characters";
}
}
</script>
Password: <input id="upass" type="password" name="userpass">
<input id="toggleBtn" type="checkbox" onclick="togglePassword()"><span id='test_toggle'>Show Password Character</span>

Live Demo

No comments:

Post a Comment

Thank your for your comment..your submitted coment will be live after admin approval