Skip to content
Advertisement

Create element inside another based on id

rigth now I have this code to draw some divs (based on some logic I’ll have parent and childs.

JavaScript

So, my question is: if there is a way to get the parentDiv and draw inside the X childs elements and how can I do it? I tried with this:

JavaScript

But I’m getting the .appendTo() is not a function error message.

Advertisement

Answer

.appendTo() is a jQuery method, it seems you are using plain javascript, maybe you want to use append or appendChild

Advertisement