I am working on a javascript project, and I am having trouble displaying an appended string. Right now, I am trying to change Crawler1 and Crawler2 to username that a user input. These usernames are stored in local storage:
This is the JS script I am using in order to change the p1 and p2 values to the user names. I am very confused why nothing is appending, because when I use a window.alert box,
localStorage.getItem("name") and localStorage.getItem("name2") print the expected values.
document.forms["game"]["p1"].innerHTML = localStorage.getItem("name");
document.forms["game"]["p2"].innerHTML = localStorage.getItem("name2");
<div id="wrap">
<div id="left_col">
<p id="p1">Crawler 1</p>
</div>
<div id="right_col">
<p id="p2">Crawler 2</p>
</div>
</div>
does anyone have any idea why the p1 and p2 values wouldn't be changing?