riix
7/24/2012 - 4:36 AM

jQuery Password field disappearing default

jQuery Password field disappearing default

<!--   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();
    }
});