Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <body> <h1>My First JavaScript</h1> <p id="demo"> JavaScript can change the content of an HTML element. </p> <script> function myFunction() { x=document.getElementById("demo"); // Find the element x.innerHTML="Hello JavaScript!"; // Change the content } </script> <button type="button" onclick="myFunction()">Click Me!</button> </body> </html>
Result:
W3Schools.com - Try it yourself