views:

1875

answers:

2

I'm getting this error after trying to "appendChild" to an element that was just created (in for loop).
What does this error mean?
I suppose it's not possible to append sth. to an element that doesn't really exist in DOM.
How do I fix it?
"innerHTML" works, but I don't think it's really clean and proper way to do it.

A: 

first hit on google: http://bustedmug.blogspot.com/2006/11/select-boxes-and-could-not-convert_30.html

I.devries
I checked the site before I asked the question. However, the link to Quirksmode is broken and the meaning of error is still not clear to me.
perfectDay
Well it says "You have to instantiate an option object or else JS will error while trying to convert."This probably means that what you're trying to append is not a node. Can you post some relevant code?
I.devries
I wanted to append a code stored in variable. I finally sticked with innerHTML. It even ended out as more useful.
perfectDay
+1  A: 

There's nothing wrong with innerHTML if you don't need to add events to the new element.
You can add events later using standard methods anyway

meouw