wierd js error

Posted on 2006-10-29
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
  • 2
LVL 63

Accepted Solution

Zvonko earned 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

932 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now