The disabled attribute is used to make an input element inactive and unclickable. A disabled input field cannot be edited or submitted with the form.
- Prevents users from interacting with the input element, including editing, clicking, or focusing.
- Disabled fields are not included when the form data is submitted.
- It is a boolean attribute and works with form elements like <input>, <button>, and <select>.
Syntax:
<input disabled><!--Driver Code Starts-->
<!DOCTYPE html>
<html>
<head>
<title>HTML input disabled Attribute</title>
</head>
<!--Driver Code Ends-->
<body style = "text-align:center">
<h1 style = "color: green;">GeeksforGeeks</h1>
<h2>HTML input disabled Attribute</h2>
<label>Input:
<!--A disabled input-->
<input type="text" name="value" value = "This input field is disabled" disabled>
</label>
</body>
<!--Driver Code Starts-->
</html>
<!--Driver Code Ends-->