How to attach a DIV to another DIV using DOM

0
var X = createElement('div');
document.body.appendChild(X);

var Y = createElement('div);

as an attachment to div X to div Y?

    
asked by anonymous 25.03.2015 / 20:07

1 answer

2

Instead of document.body.appendChild(X); (which attaches to body ), use:

Y.appendChild(X);
    
25.03.2015 / 20:14