readonly 属性规定是否允许用户编辑 Textarea 的内容。
如果 readonly 为 true,则用户无法编辑 textarea 中的内容。如果 readonly 为 false(默认),则用户可以编辑 textarea 中的内容。
该属性在所有主流浏览器中都得到支持。
readonly 属性的值可以是 "readonly" 或 empty string ("").
以下示例创建一个具有 readonly 属性的 textarea 元素:
document.getElementById("myTextarea").readOnly = true;
readonly 属性是 html5 中的新属性。
本文地址:https://www.qianwe.com/article/976dc24faf45dcda884d.html