0

我在 IE10 上尝试创建 xml 节点并向 nodeValue 添加值时遇到 js 错误。

错误:

This operation can not be performed with a node of type ELEMENT. 

代码:

var displayValueElement = this.properties.createElement("Property");

if ($.browser.msie)
{
    displayValueElement.nodeValue = "some value"; //error is here
}

该代码适用于 Chrome 和 Firefox,但 IE 必须使用 nodeValue。

displayValueElement.textContent = displayValue;

注意:this.properties 是从 parseXML() 返回的 xml 文档

在此先感谢,如果需要更多说明,请告诉我。

4

1 回答 1

1

我想我可以求助于使用 jQuery 而不是原始的 javascript ......

$(displayValueElement).text(displayValue);
于 2013-11-08T00:29:07.793 回答