Javascript examples for DOM:Quiz
Add an onclick event attribute to <button>. Clicking the button should trigger myFunction().
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Click Me</button> <p id="demo"></p> <script> function myFunction() {//from www . j a v a2 s. c o m document.getElementById("demo").innerHTML = "Hello World"; } </script> </body> </html>