Return to Snippet

Revision: 58412
at July 13, 2012 07:12 by ryonley


Initial Code
<!--   HTML  -->
<input id="password-clear" type="text" value="Password" autocomplete="off" /> 
<input id="password-password" type="password" name="password" value="" autocomplete="off" />

//  CSS

#password-clear {
    display: none;
}

// JQUERY

$('#password-clear').show();
$('#password-password').hide();

$('#password-clear').focus(function() {
    $('#password-clear').hide();
    $('#password-password').show();
    $('#password-password').focus();
});
$('#password-password').blur(function() {
    if($('#password-password').val() == '') {
        $('#password-clear').show();
        $('#password-password').hide();
    }
});

Initial URL
http://www.electrictoolbox.com/jquery-toggle-between-password-text-field/

Initial Description
There are two input fields for password.. One is of type text and the other is password.    Their visibility is basically toggled.

Initial Title
Jquery Password field disappearing default

Initial Tags

                                

Initial Language
JavaScript