Open In App

How to specify that an input element should be disabled ?

Last Updated : 25 Dec, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

tn this article, we will disable the input field using HTML. The disabled attribute for <input> element is used to specify that the input field is disabled. A disabled input is un-clickable and unusable. It is a boolean attribute. The disabled <input> elements are not submitted in the form.

Syntax:

<input disabled>

When the disabled attribute is present, it specifies that the input field is disabled. We can not write any content on disabled input field.

Example:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>
        How to specify that an input element 
        should be disabled in HTML?
    </title>
</head>
  
<body style="text-align:center">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
      
    <h2>
        How to specify that an input element 
        <br>should be disabled in HTML?
    </h2>
  
    <label>Disabled Input Field:
  
        <!--A disabled input-->
        <input type="text" name="value" 
            value="This input field 
            is disabled" disabled>
    </label>
</body>
  
</html>


Output:

Supported Browsers:

  • Apple Safari 1.0
  • Google Chrome 1.0
  • Firefox 1.0
  • Opera 1.0
  • Internet Explorer 6.0

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads