i am trying to create the new pieces on the board, and then append them to the starting section. I keep getting 'null' displayed when appending the newly created div.
const playerOneStart = function(){
createP1Captain= document.createElement('div');
createP1Captain.setAttribute('id', 'p1Captain');
createP1Bomb = document.createElement('div');
createP1Bomb.setAttribute('id', 'p1Bomb');
createP1Flag = document.createElement('div');
createP1Flag.setAttribute('id', 'p1Flag');
createP1Major = document.createElement('div');
for(i=0; i<6; i++){
createP1Major.setAttribute('class', 'p1Major');
};
console.log('creating p1 pieces')
};
const appendP1 = function(){
p1Cont.append(p1Major)
also this is defined
const p1Cont = document.querySelector("#pieceHolder > div.p1Container")
and append child has not been working either
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment