Tryit Editor v1.8

Source Code:
<!DOCTYPE html> <html> <body> <p>Click the button to replace "Microsoft" with "W3Schools" in the paragraph below:</p> <p id="demo">Visit Microsoft!</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { var str = document.getElementById("demo").innerHTML; var res = str.replace("Microsoft","W3Schools"); document.getElementById("demo").innerHTML=res; } </script> </body> </html>
Result:
W3Schools.com - Try it yourself