[英]Can't change text after set readOnly=false IE
我有此示例代码,并且它不能仅在IE中工作。 是否有IE错误?
<input type="text" readonly="true" onclick="setReadonlyfalse(this)" />
<script type="text/javascript">
function setReadonlyfalse(ed){
ed.readOnly = false;
}
</script>
我正在模拟一种情况,在网格显示编辑器后,我收到服务器的响应,将编辑器设置为readonly = false。 (它使用readonly = true呈现)
编辑:
我正在使用ExtJS 3.4,并且代码执行此操作:
/**
* Sets the read only state of this field.
* @param {Boolean} readOnly Whether the field should be read only.
*/
setReadOnly : function(readOnly){
if(this.rendered){
this.el.dom.readOnly = readOnly;
}
this.readOnly = readOnly;
}
edit2 :我调整了代码,使其更正确
<input type="text" readonly="readonly" onclick="removeReadonly(this)" value="hehehe" />
<script type="text/javascript">
function removeReadonly(ed){
ed.removeAttribute("readonly");
}
</script>
以编程方式从元素中移除readonly
属性,然后将readOnly
设置为false
。
ed.removeAttribute('readonly'); // only needed the first time
ed.readOnly = false;
是的,这是一个IE错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.