Password

The password form element, like the text form element, allows a visitor to type a line of text into a form. In a password element, however, asterisks or bullets replace the letters to hide the contents from view. The element is represented like this in HTML: <input type = "password">.

Properties

defaultValue

FF, IE 3

Read-only: Browser-set default value for the element

Form

FF, IE 3

Read-only: Form containing the element

maxLength

FF, IE 4

Maximum number of characters allowed in the field

name

FF, IE 3

Name of the password field

readOnly

FF, IE 4

true if users can't enter data into the field

size

FF, IE 4

Width of the field

type

FF, IE 4

Read-only: Set to 'PASSWORD'

value

FF, IE 3

Text that appears in the password field

Example:

<input type = "password" onChange ...

Get The Book of JavaScript, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.