Solved

wierd js error

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

Accepted Solution

by:
Zvonko earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article discusses how to create an extensible mechanism for linked drop downs.
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…

771 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

12 Experts available now in Live!

Get 1:1 Help Now