用密码字段切换文本字段(聚焦)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了用密码字段切换文本字段(聚焦)相关的知识,希望对你有一定的参考价值。
Originally form http://www.electrictoolbox.com Comes in handy if you want to display a message in the field (\"type your password\") but mask the password itself.
//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" />
以上是关于用密码字段切换文本字段(聚焦)的主要内容,如果未能解决你的问题,请参考以下文章