Source Code:
(back to article)
Submit
Result:
Report an issue
<!DOCTYPE html> <html> <head> <title>Title of the document</title> <style> #w3docs { color: #666; } </style> </head> <body> <h1 id="w3docs">Example</h1> <button onclick="displayResult()"> Click here </button> <script> function displayResult() { document.getElementById( "w3docs") .innerHTML = "Hello world!"; } </script> </body> </html>