HTML Input Box - Disable

HtmlInput

Html Problem Overview


what is the code to disable an INPUT text box for HTML?

Thanks

Html Solutions


Solution 1 - Html

<input type="text" disabled="disabled" />

See the http://www.w3.org/TR/html-markup/input.text.html">W3C HTML Specification on the input tag for more information.

Solution 2 - Html

<input type="text" required="true" value="" readonly="true">

This will make a text box in readonly mode, might be helpful in generating passwords and datepickers.

Solution 3 - Html

The syntax to disable an HTML input is as follows:

<input type="text" id="input_id" DISABLED />

Solution 4 - Html

You can Use both disabled or readonly attribute of input . Using disable attribute will omit that value at form submit, so if you want that values at submit event make them readonly instead of disable.

<input type="text" readonly> 

or

 <input type="text" disabled>

Solution 5 - Html

<input type="text" required="true" value="" readonly>

Not the.

<input type="text" required="true" value="" readonly="true">

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDavid BonniciView Question on Stackoverflow
Solution 1 - HtmlGregView Answer on Stackoverflow
Solution 2 - HtmlkirubaView Answer on Stackoverflow
Solution 3 - Htmlfasih.ranaView Answer on Stackoverflow
Solution 4 - HtmlsjsupersumitView Answer on Stackoverflow
Solution 5 - HtmlDeep SojitraView Answer on Stackoverflow