HTML input box - disable

What is the code to disable the INPUT text field for HTML?

thank

+47
html input
Dec 16 '08 at 20:36
source share
4 answers
<input type="text" disabled="disabled" /> 

See the W3C HTML Specification for an input tag for more information.

+77
Dec 16 '08 at 20:38
source share
β€” -
 <input type="text" required="true" value="" readonly="true"> 

This will make the text field readonly, which can be useful when creating passwords and datepickers.

+45
Nov 27
source share

The syntax for disabling HTML input is as follows:

 <input type="text" id="input_id" DISABLED /> 
+9
Dec 16 '08 at 20:39
source share

You can use both disabled or readonly attributes for input. Using the disable attribute will omit this value in the submit form, so if you want these values ​​in the submit event to make them read-only, not disconnected.

 <input type="text" readonly> 

or

  <input type="text" disabled> 
+4
Apr 26 '15 at 11:39 on
source share



All Articles