在密码字段中的html表单中,值不显示为密码

时间:2014-02-17 12:01:31

标签: html5 forms

我为网页创建的html表单中的密码字段未显示密码值。它显示“...”而不是“密码”。

这是代码......

<form id="form">
    <div class="success_wrapper">
        <div class="success">Contact form submitted!
            <br> <strong>Thank you For Registering</strong> 
        </div>
    </div>
    <fieldset>
        <label class="name">
            <input type="text" value="Name:">
            <br class="clear"> <span class="error error-empty">*This is not a valid name.</span><span class="empty error-empty">*This field is required.</span> 
        </label>
        <label class="email">
            <input type="text" value="E-mail:">
            <br class="clear"> <span class="error error-empty">*This is not a valid email address.</span><span class="empty error-empty">*This field is required.</span> 
        </label>
        <label class="phone">
            <input type="tel" value="Phone:">
            <br class="clear"> <span class="error error-empty">*This is not a valid phone number.</span><span class="empty error-empty">*This field is required.</span> 
        </label>
        <label class="password">
            <input type="Password" value="Password:">
            <br class="clear"> <span class="empty error-empty">*This field is required.</span>
        </label>
        <div class="clear"></div>
        <div class="btns"><a data-type="submit" class="btn">sign in</a>

            <div class="clear"></div>
        </div>
    </fieldset>
</form>

3 个答案:

答案 0 :(得分:0)

这对我来说很好,我复制粘贴代码: http://www.onlinehtmleditor.net/

它运作正常。 也许这个问题是因为你使用了大写的“密码”和“密码”?

答案 1 :(得分:0)

您的代码工作正常,如果您想要“密码:”作为占位符文本使用属性“占位符”,如

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

它可以在HTML5中使用

答案 2 :(得分:0)

您需要添加placeholder="Password"而不是value="Password"

只需替换此行

<input type="Password" value="Password:">

使用

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