Menu
I’m having some trouble adding text to a div. More specifically, I can’t seem to be able to add text to the text I’ve added before, it just replaces the old text every time.
I’ve tried
[CODE]function update(newMessage){
var next = document.createElement(“p”);
next.innerHTML = newMessage;
document.getElementById(‘textbox’).appendChild(next);
}
and
[CODE]function update(newMessage){
document.getElementById(‘textbox’).innerHTML += newMessage;
}
Can anyone tell me what I’m doing wrong? Because as far as I can see, even though I’m seeing the text, nothing seems to be added to the html itself when I look at the source.