HTML <input> disabled Attribute
Definition and Usage
disabled
The attribute specifies that the input element should be disabled.
disabled
The attribute is a boolean attribute.
Disabled input elements are neither usable nor clickable.
Can be set disabled
The attribute is used to prevent users from using the <input> element until certain other conditions are met (such as checking a checkbox, etc.). Then, JavaScript can remove the disabled value and make the <input> element available.
Tip:Disabled <input> elements in the form will not be submitted!
Note:disabled
Attributes cannot be combined with <input type="hidden"> Use Together.
Example
HTML form with a disabled input field:
<form action="/action_page.php"> <label for="fname">First Name:</label> <input type="text" id="fname" name="fname"><br><br> <label for="lname">Last Name:</label> <input type="text" id="lname" name="lname" disabled><br><br> <input type="submit" value="Submit"> </form>
Syntax
<input disabled>
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |