HTML <input> disabledAttribute

HTML input 标签参考手册HTML <input> tag

Example

An HTML form with a disabled input field:

<form action="demo_form.php">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname" disabled><br>
<input type="submit" value="提交">

Try it Yourself »

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 that the <input> element should be disabled.

A disabled input element is unusable and unclickable.

The disabled attribute can be set to prevent the user from using the <input> element until some other condition has been met (such as selecting a checkbox, etc.). Then, a JavaScript could remove the disabled value to make the <input> element usable again.

Tip:Disabled <input> elements in a form will not be submitted.

Note:The disabled attribute is not applicable to <input type="hidden">.


Differences between HTML 4.01 and HTML5

None.


Differences between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the disabled attribute must be defined as <input disabled="disabled" />.


Syntax

<input disabled>


HTML input 标签参考手册HTML <input> tag Other Extensions