[Solved] Buttons in HTML/Javascript [closed]

[ad_1]

Use .innerHTML to replace elements within a DOM object.

function ReplaceText(){
  document.getElementById("mytext").innerHTML = "My new text";
}
<html>

  <head>
  </head>

  <body>

    <div id="mytext">
      My text
    </div>

    <button id="replace" onclick="ReplaceText()"> Replace Text </button>

  </body>

</html>

[ad_2]

solved Buttons in HTML/Javascript [closed]