Solved

wierd js error

Posted on 2006-10-29
3
994 Views
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);
                  }
0
Comment
Question by:wrynn
[X]
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
3 Comments
 
LVL 63

Accepted Solution

by:
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");

0
 

Author Comment

by:wrynn
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
0
 
LVL 63

Expert Comment

by:Zvonko
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;
   if(opt[0].text==""){
      opt[0].text = "Option Text";
   }

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

710 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