Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Password readOnly Property

Password readOnly Property

Password Object Reference Password Object


Definition and Usage

The readOnly property sets or returns whether the password field is read-only.

A read-only field cannot be modified. However, the user can select it and copy the text.

Syntax

Set the readOnly property:

passwordObject.readOnly=true|false

Return the readOnly property:

passwordObject.readOnly


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the readOnly property


Example

Example

The following example sets the password field to read-only:

Runoob Tutorial(runoob.com)

Password:

Try it »


Password Object Reference Password Object