Skip to content
Advertisement

Failed to execute ‘appendChild’ on ‘Node’: Nodes of type ‘a’ may not be inserted inside nodes of type ‘LI’

I just started to learn Javascript, and I’m trying to append anchor tag inside the li tag.

JavaScript

This was how I did it. But when I run this,

“Failed to execute ‘appendChild’ on ‘Node’: Nodes of type ‘a’ may not be inserted inside nodes of type ‘LI’.”

this error came out. How can I fix it?

Advertisement

Answer

first you need to create an element (a)

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement