如何获得密码字段摆脱占位符接替标签 [英] How to get rid of placeholder on password field taken over from label

查看:162
本文介绍了如何获得密码字段摆脱占位符接替标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法摆脱对密码文本框不必要的占位符(或水印)的。当密码文本框的重点是,Android的Web浏览器显示的占位符的相关标签元素取代,像这样的:

HTML源代码:

 <形式方法=邮报>
    <标签=username的>登录名:LT; /标签>
    <输入ID =username的名称=username的类型=文字值=/>

    <标签=密码>密码:LT; /标签>
    <输入ID =密码NAME =密码类型=密码/>

    <输入类型=提交ID =提交名称=提交值=登陆/>
< /形式GT;
 

请注意:

  • 仅当文本框具有焦点,并且是空的占位符显示。
  • 使用密码输入占位符HTML属性,它只是显示,直到密码被聚焦。当它接收焦点,它显示标签文字。
  • 我不想删除标签的属性。我希望标签可以点击和密码文本框获得焦点的标签被点击时。

编辑:

尝试另一种变型(这避免了为属性),但该占位符仍然present:

 <标签>密码:其中,输入ID =密码NAME =密码类型=密码/>< /标签>
 

解决方案

下面的CSS可以禁用此:

  -webkit-用户修改:读写明文只;
 

I can't get rid of unwanted placeholder (or watermark) on password textbox. When password textbox is focused, Android web browser displays placeholder overtaken from associated label element, like this:

HTML source:

<form method="post">
    <label for="userName">Login name:</label>
    <input id="userName" name="userName" type="text" value="" />

    <label for="password">Password:</label>
    <input id="password" name="password" type="password" />

    <input type="submit" id="submit" name="submit" value="Log In" />
</form>

Note:

  • Placeholder is displayed only when the textbox has focus and is empty.
  • When using "placeholder" HTML attribute on password input, it is displayed only until the password gets focused. When it receives focus, it displays label text instead.
  • I don't want to delete the "for" attribute of the label. I want the label to be clickable and the password textbox to get focus when the label is clicked.

Edit:

Tried another variant (which avoids "for" attribute), but the placeholder is still present:

<label>Password: <input id="password" name="password" type="password" /></label>

解决方案

the following css can disable this:

-webkit-user-modify: read-write-plaintext-only;

这篇关于如何获得密码字段摆脱占位符接替标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆