Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


wierd js error

Posted on 2006-10-29
Medium Priority
Last Modified: 2008-01-09
Error: uncaught exception: [Exception... "Node cannot be inserted at the specified point in the hierarchy"  code: "3" nsresult: "0x80530003 (NS_ERROR_DOM_HIERARCHY_REQUEST_ERR)"  location: "file.js Line: 34"]

the code that caused it is this:

if(isUndefined(option.childNodes[0])) {
                        var txtNode = document.createTextNode(data);
                  /* line 34 */      option.appendChild(txtNode);
Question by:wrynn
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 63

Accepted Solution

Zvonko earned 2000 total points
ID: 17828330
What do you intend to do there?
Do you know the simple stright way to create Options?
Like this:

   var opt = document.forms[0].yourSelectName.options;
   opt[opt.length] = new Option("theOption Text", "theOptValue");


Author Comment

ID: 17829222
im trying to check to see if the option node has a text node, if it doesnt then i append one to it
LVL 63

Expert Comment

ID: 17830617
What is an option Node for you?
If it is a select option, then it is like this:

   var opt = document.forms[0].yourSelectName.options;
      opt[0].text = "Option Text";


Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using, I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question