HTML DOM Password readOnly property
Definition and Usage
readOnly property sets or returns whether the password field is read-only.
Read-only field can not be modified. However, users can select it and copy the text.
grammar
Set readOnly properties:
passwordObject.readOnly=true|false
Back readOnly attributes:
passwordObject.readOnly
Browser Support
All major browsers support readOnly property
Examples
Examples
The following example code field is set to read-only:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function setResult () {
document.getElementById ( "pwd") readOnly = true.;
}
</ Script>
</ Head>
<Body>
<Form>
Password: <input type = "password" id = "pwd">
</ Form>
<Button type = "button" onclick = "setResult ()"> Set read-only </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function setResult () {
document.getElementById ( "pwd") readOnly = true.;
}
</ Script>
</ Head>
<Body>
<Form>
Password: <input type = "password" id = "pwd">
</ Form>
<Button type = "button" onclick = "setResult ()"> Set read-only </ button>
</ Body>
</ Html>
try it"
Password objects