I am trying to modify the text of a div
element. It isn't even changing the existing text, it is just adding a paragraph element to the top of the screen.
Code:
function addContent() {
document.getElementById("test").innerHTML = "Something";
}
<div id="test">This is some text</div>
<button class="btn btn-primary btn-lg" id="getStartedButton" onclick="addContent()">Get Started</button>
But instead of editing the text within the test div
. It creates a new p
element at the top of the page with the id="test"
Does this have anything to do with bootstraps?
Thanks in advance!
UPDATE: Amy below helped with this issue, thank you!