Solution: Hello World on pressing button
examples/js/hello_world.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <title>Hello World</title> </head> <body> <button id="go">Say hello</button> <div id="result"></div> <script src="hello_world.js"></script> </body> </html>
examples/js/hello_world.js
"use strict"; function greet() { document.getElementById('result').innerHTML = 'Hello World'; return false; } document.getElementById('go').addEventListener('click', greet);