Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of placeholder on password field taken over from label

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:

enter image description here

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>
like image 581
dkl Avatar asked Jul 26 '11 09:07

dkl


2 Answers

the following css can disable this:

-webkit-user-modify: read-write-plaintext-only;
like image 124
emjaksa Avatar answered Oct 02 '22 03:10

emjaksa


I think you need the place holder in android. For that use the property of Edittext

android:hint="Username"

<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textNoSuggestions" android:id="@+id/textName" android:hint="Username"></EditText>
<EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="textEmailAddress" android:id="@+id/textEmail" android:hint="Email"></EditText>
like image 36
Asish AP Avatar answered Oct 02 '22 03:10

Asish AP