我们已经准备好了,你呢?

我们与您携手共赢,为您的企业形象保驾护航!

当前位置: 首页 > 问答 > htmlreadonly

HTML Readonly

HTML Readonly Attribute

The readonly attribute specifies that an input field is read-only (not editable).

Syntax:

<input readonly="readonly" />

The attribute is added to the <input> element to make it read-only. The value of the readonly attribute is set to "readonly".

Example:

<input type="text" readonly="readonly" value="This input field is read-only." />

In the above example

the <input> element with the type set to "text" is made read-only using the readonly attribute. The value attribute is used to set the initial value of the input field.

When a form is submitted

the data in a read-only input field is sent to the server

just like any other input field. However

since the field is read-only

the user cannot modify the value before submitting the form.

If you want to prevent the data in the input field from being sent to the server

you can use the disabled attribute instead. The disabled attribute also makes the input field uneditable

but it does not submit the data when the form is submitted.

Note: The readonly attribute is only valid for the <input> element and its variations (e.g.

<input type="text">

<input type="password">

etc.).

免责声明:本站内容(文字信息+图片素材)来源于互联网公开数据整理或转载,仅用于学习参考,如有侵权问题,请及时联系本站删除,我们将在5个工作日内处理。联系邮箱:chuangshanghai#qq.com(把#换成@)

我们已经准备好了,你呢?

我们与您携手共赢,为您的企业形象保驾护航!

在线客服
联系方式

热线电话

132-7207-3477

上班时间

周一到周五 09:00-18:00

二维码
线