I am trying to append four <canvas> elements to a node, appendChild() seems to get rid of what was already there, so i tried to combine them all before appending them... what is the best way to do this, I get DOM exception 8 with what i have below.
// Initialize Canvases var newCanvas1 = document.createElement('canvas'); newCanvas1.setAttribute('width', 300); newCanvas1.setAttribute('height', 300); var newCanvas2 = newCanvas1, newCanvas3 = newCanvas1, newCanvas4 = newCanvas1; newCanvas1.setAttribute('id', nodeID + 'canvas1'); newCanvas2.setAttribute('id', nodeID + 'canvas2'); newCanvas3.setAttribute('id', nodeID + 'canvas3'); newCanvas4.setAttribute('id', nodeID + 'canvas4'); var canvases = newCanvas1 + newCanvas2 + newCanvas3 + newCanvas4; console.log(canvases); node.appendChild(canvases);