/ Published in: jQuery
Originally form http://www.electrictoolbox.com\r\nComes in handy if you want to display a message in the field (\\\"type your password\\\") but mask the password itself.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
//src: http://www.electrictoolbox.com/jquery-toggle-between-password-text-field/ $(document).ready(function () { $('#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(); } }); }); --- #password-clear { display: none; } ---- <input id="password-clear" class="form-text default-value" type="text" value="Type your password" autocomplete="off" /> <input id="password-password" class="form-text default-value" type="password" name="password" value="" autocomplete="off" />