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

HTML input disabled attribute

HTML disabled attribute

HTML input Tag Reference HTML tag

Example

An HTML form with a disabled input field:

First name:

Last name:

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.


Definition and Usage

The disabled attribute is a boolean attribute.

The disabled attribute specifies the element to be disabled. .

A disabled input element is unusable and unclickable.

Set the disabled attribute so that the user can only use the element when certain conditions are met (such as checking a checkbox, etc.). Then, JavaScript can be used to remove the disabled value, making the element usable again.

**Tip:** Disabled elements in a form are not submitted.

**Note:** The disabled attribute does not apply to the .


Differences between HTML 4.01 and HTML5

none.


Differences between HTML and XHTML

In XHTML, attribute minimization is forbidden; the disabled attribute must be defined as .


Syntax


HTML input Tag Reference HTML tag