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.
views:
1875answers:
2
A:
first hit on google: http://bustedmug.blogspot.com/2006/11/select-boxes-and-could-not-convert_30.html
I.devries
2008-12-28 20:51:30
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
2008-12-28 21:14:55
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
2008-12-29 07:43:16
I wanted to append a code stored in variable. I finally sticked with innerHTML. It even ended out as more useful.
perfectDay
2009-01-01 22:34:14
+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
2008-12-28 21:16:58