javascriptjqueryinternet-explorer-9domexception

DOM Exception: HIERARCHY_REQUEST_ERR (3) error


The following code works fine in chrome and Firefox, but breaks in IE 9.0.

message.nodeTree.childNodes[1].childNodes[0].childNodes[0].appendChild(pkf_util.createXmlTextNode(text));

when I try to input something via textarea,it comes with SCRIPT5022:

DOM Exception: HIERARCHY_REQUEST_ERR (3) line 481 character 29;

Any ideas why it's not working in IE 9.0?


Solution

  • I know its a long time since the Q was asked but I reached it based on the error message. specifically in my case I was getting the following error: "HIERARCHY_REQUEST_ERR: DOM Exception 3: A Node was inserted somewhere it doesn't belong.".

    I was trying to append a node that I was creating using jquery to some other node in my html document. It turned out that by mistake I used $('div') instead of $('<div>') for the creating the new (appended) node.

    I hope this will help someone in the future.