I am trying to add a string variable as a child of a node. The code that I’m using looks like this
$(this).parentNode.parentNode.insertBefore('content',$(this).parentNode)
I believe that this is correct syntax, but I keep receiving NOT_FOUND_ERR: DOM Exception 8. Does anyone have any pointers?
if you want to insert a new element BEFORE a node
if you want to append a new textNode to the element you rather need
but what really bothers me is that you seem to using jQuery or some framework, and use DOM methods on them. Because that won’t work.
You need to use their own methods then, like: