<input type="password">

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O
Type

The INPUT element defines an input field. When you specify "password" for the type attribute of this element, a password text box is created.

The input text is displayed as asterisks or bullets.


<input type="password" name="pass1">

<input type="password" name="pass2" size="30" maxlength="30" value="Example">

Attribute Value Explanation
type=" " password the type of input field
name=" " field name a unique name for the field
size=" " number of characters the input field width
maxlength=" " number of characters the maximum number
value=" " initial value the text displayed in the field
type="password"
Creates a password text box on the form.
name=""
The field name is used to identify the form field.
size=""
The input field width is specified by the number of characters.
maxlength=""
Specifies the maximum number of characters allowed in the input field.
value=""
Specifies the initial text displayed in the input field.

Example


<form method="POST" action="example.cgi">

<p>Default<br>
<input type="password" name="example1"></p>

<p>size="30"<br>
<input type="password" name="example2" size="30"></p>

<p>maxlength="10"<br>
<input type="password" name="example3" size="30" maxlength="10"></p>

<p>value="Hello!"<br>
<input type="password" name="example4" size="30" value="Hello!"></p>

</form>

Output

Default

size="30"

maxlength="10"

value="Hello!"

This form cannot submit because of a sample.