jQuery Show Password Example

<!DOCTYPE html>
<html>
<head>
    <title>Show Password</title>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">
        function show_password(){
            var pw=document.getElementById("mypassword");
            if($("#checkbox1").is(":checked")==true){
                pw.type="text";
            }
            else{
                pw.type="password";
            }
        }           
    </script>
</head>
<body>
<form id="form">
    <input type="password" name="password" id="mypassword" value="Sachin">
    <input type="checkbox" value="Show" id="checkbox1" onclick="show_password()">Show
</form>
</body>
</html>

Comments