Meow
Meow

Reputation: 19071

How to create xml element and add nodeValue on IE

I'm getting js error on IE10 trying to create an xml node and add value to nodeValue.

Error:

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

Code:

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

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

The code works on Chrome and Firefox but IE has to use nodeValue.

displayValueElement.textContent = displayValue;

Note: this.properties are xml document that is returned from parseXML()

Thanks in advance, please let me know if need more clarification.

Upvotes: 0

Views: 179

Answers (1)

Meow
Meow

Reputation: 19071

I guess I can resort to using jQuery rather than raw javascript...

$(displayValueElement).text(displayValue);

Upvotes: 1

Related Questions