Return to Snippet

Revision: 41955
at February 25, 2011 09:10 by galofre


Initial Code
The HTML

<form>
<div>
    <input class="default-value" type="text" name="email" value="Email Address" />
</div>
<div>
    <input id="password-clear" type="text" value="Password" autocomplete="off" />
    <input id="password-password" type="password" name="password" value="" autocomplete="off" />
</div>
</form>



The CSS
#password-clear {
    display: none;
}




The 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

                                

Initial Title
jQuery: show plain text in a password field and then make it a regular password field on focus

Initial Tags
jquery

Initial Language
PHP