如何获得密码字段摆脱占位符接替标签字段、如何获得、密码、标签

由网友(昨日最亲某某)分享简介:我无法摆脱对密码文本框不必要的占位符(或水印)的。当密码文本框的重点是,Android的Web浏览器显示的占位符的相关标签元素取代,像这样的:HTML源代码:<形式方法=邮报><标签=username的>登录名:LT; /标签><输入ID =username的名称=username的...

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

HTML源代码:

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

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

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

请注意:

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

编辑:

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

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

解决方案

下面的CSS可以禁用此:

  -webkit-用户修改:读写明文只;
 
举个栗子 Tableau 技巧 135 三种方法移除 Abc 占位符

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;

阅读全文

相关推荐

最新文章