David Bonnici
David Bonnici

Reputation: 6747

HTML Input Box - Disable

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

Thanks

Upvotes: 53

Views: 132987

Answers (5)

Deep Sojitra
Deep Sojitra

Reputation: 87

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

Not the.

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

Upvotes: 2

sjsupersumit
sjsupersumit

Reputation: 164

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>

Upvotes: 9

Greg
Greg

Reputation: 321796

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

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

Upvotes: 84

kiruba
kiruba

Reputation: 589

<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.

Upvotes: 58

fasih.rana
fasih.rana

Reputation: 1655

The syntax to disable an HTML input is as follows:

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

Upvotes: 10

Related Questions