Latest web development tutorials

HTML DOM Input Text disabled property

Input Text Object Reference Input Text Object

Examples

Disabled text fields:

. Document.getElementById ( "myText") disabled = true;

The output is:


try it"


Definition and Usage

disabled property sets or returns whether the text field is disabled.

Disabled elements are not available and can not be clicked. Disable element is usually displayed on the browser gray.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.


grammar

Returns disabled properties:

textObject .disabled

Set the disabled attribute:

textObject .disabled = true | false

Property Value

value description
true | false It describes whether the text field is disabled.
  • true - text fields are disabled
  • false - default. Text fields are available.

Technical details

return value: Boolean value that, if a text field is disabled returns true, false otherwise


More examples

Examples

Check whether the text field is disabled:

var x = document.getElementById ( "myText") disabled.;

x The output is:

false

try it"

Examples

Disable and enable text fields:

function disableTxt () {
. Document.getElementById ( "myText") disabled = true;
}

function undisableTxt () {
. Document.getElementById ( "myText") disabled = false;
}

try it"


Related Pages

HTML Reference Manual: HTML <the INPUT> Disabled Property


Input Text Object Reference Input Text Object