Latest web development tutorials

HTML input disabled property

HTML input Tag Reference HTML <input> tag

Examples

HTML form with a disabled input fields:

<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"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.


Definition and Usage

disabled attribute is a Boolean attribute.

disabled property provisions should be disabled <input> elements.

Disabled input elements can not be used and can not be clicked.

When disabled attribute set, allowing users to meet certain conditions (such as the check box, etc.) in order to use <input> elements. Then, you can use JavaScript to remove the disabled value, so that the <input> elements into a usable state.

Note: the form is disabled <input> element will not be submitted.

Note: disabled property is not available for <input type = "hidden"> .


Differences between HTML 4.01 and HTML5

no.


Differences between HTML and XHTML

In XHTML, prohibit attribute minimization, disabled attribute must be defined as <input disabled = "disabled" />.


grammar

<input disabled>


HTML input Tag Reference HTML <input> tag