The argument required for getElementById requires id of the HTML element you wish to use.
<h1>Element change example.</h1>
<p id="elementone">This is element one.</p>
<div id="elementtwo">This is element two.</div>
<button type="button" onclick="chgElements()">Click me to change element values</button>
document.getElementById("elementone").innerHTML="An element one has been changed at runtime";
document.getElementById("elementtwo").innerHTML="An element two has been changed at runtime";
<p>When you click on "Click me to change element values", the value of two elements will change.</p>
No responses found. Be the first to comment...