【问题标题】:how to show text in input field "password" and after typing on it switch again to password view如何在输入字段“密码”中显示文本并在输入后再次切换到密码视图
【发布时间】:2013-08-21 07:37:59
【问题描述】:

我有一些登录密码字段:

 <input type="password" name="password" id="password" value="Password" maxlength="40" required style="width: 130px; font-size: 10px;" />

作为输出,我有一个值为“密码”的密码字段,其显示就像"********",是什么
清楚地。 但我想将其视为文本“密码”,然后在 show ******** 中输入。该怎么做??

【问题讨论】:

    标签: javascript html input-field


    【解决方案1】:

    使用placeholder 属性。

    <input type="password" placeholder="Password" />
    

    jsFiddle.

    【讨论】:

    • 所以???
    • @RagimsRagimovs 试试看 :)
    【解决方案2】:

    这应该可行:

    <input type="password" name="password" value="password" id="password"  placeholder="Password" maxlength="40" required="" style="width: 130px; font-size: 10px;">
    

    需要注意的是,如果 value 属性在 placeholder 属性之前,它会优先,你会看到默认值设置。 (对于密码字段,对我来说没有多大意义)。

    【讨论】:

    • 是的。刚刚注意到只有在占位符之前,值才会优先。可能它只对我来说是新的。仍然认为我会分享:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-05-24
    • 2015-01-30
    • 2015-02-15
    • 1970-01-01
    • 1970-01-01
    • 2013-03-25
    • 1970-01-01
    相关资源
    最近更新 更多