Reputation: 8225
I would like to display asterisk instead of no value in password field. When I am setting up the field as type=text then I can see the plain text. When I set the type as password then I am getting blank field. Is there a way to display the value as asterisks?
<input type="text" id="txtPwd" runat="server" />
This is the field I have. Thanks in advance, Laziale
Upvotes: 4
Views: 4381
Reputation: 149000
If you want the user's text input to be replaced by asterisks you need to use a password
input—a text
input just won't do it:
<input type="password" id="txtPwd" runat="server" />
However, the default value will be blank (this applies to text
input as well). If you want to initialize this to a default value, you can do it like this:
<input type="password" value="dummy" id="txtPwd" runat="server" />
Note: I highly recommend not putting a users' password as the default value of a password field! It may compromise your users' password.
If you want to display some asterisks as placeholder text when the field is empty you can do that with with the placeholder
attribute (again, this applies to text
input as well):
<input type="password" placeholder="*****" id="txtPwd" runat="server" />
Upvotes: 2
Reputation: 2228
You can use the HTML5 placeholder
attribute:
<input type="password" placeholder="●●●●●●●●●">
Example: http://jsfiddle.net/AJ2kn/
Upvotes: 4