HTML Input Box - Disable

2019-01-19 09:35发布

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

Thanks

标签: html input
4条回答
Emotional °昔
2楼-- · 2019-01-19 09:58
<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.

查看更多
Bombasti
3楼-- · 2019-01-19 10:01
<input type="text" disabled="disabled" />

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

查看更多
虎瘦雄心在
4楼-- · 2019-01-19 10:02

The syntax to disable an HTML input is as follows:

<input type="text" id="input_id" DISABLED />
查看更多
Explosion°爆炸
5楼-- · 2019-01-19 10:09

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>
查看更多
登录 后发表回答