KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want add an element with JavaScript. I have the following code: var collection = document.getElementsByTagName('body'); var a = document.createElement('div'); a.innerHTML = 'some text'; collection.item(0).firstChild.appendChild(a); and simple HTML: <html> <head></head> <body> </body> </html> Where is mistake?
Tags (comma-separated)
Save Edits
Cancel