input element for password input
The type='password' creates an input element for entering a password. The characters that the user types are represented by a masking character, such as an asterisk (*).
Additional Attributes Available for the password Type
Attribute | Description | New in HTML5 |
---|---|---|
maxlength | maximum number of characters that user can enter . | No |
pattern | regular expression for the validation. | Yes |
placeholder | a hint to the user | Yes |
readonly | makes the password box read-only | No |
required | if the user must enter a value for the password | Yes |
size | the width of the element, the number of visible characters in the password box. | No |
value | the initial value for the password. | No |
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<form method="post" action="http://yourServer/form">
<p>
<label for="name"> Name: <input value="Adam" id="name"
name="name" />
</label>
</p>
<p>
<label for="password"> Password: <input type="password"
placeholder="Min 6 characters" id="password" name="password" />
</label>
</p>
<p>
<label for="fave"> Choice: <input value="Apples" id="fave"
name="fave" />
</label>
</p>
<button type="submit">Submit Vote</button>
</form>
</body>
</html>
Home
HTML CSS Book
HTML
HTML CSS Book
HTML
input:
- <input> element
- input element max size
- input text field size
- input text field initial value
- input text field placeholders(gray text)
- Using a Data List
- Read-Only input text field
- Disabled Text Boxes
- input element for password input
- Using the input Element to Create Buttons
Related: