Skip to main content

Exercise 33

  • Create the following folder/file structure:
/ex_33
|-- index.html

index.html

  • Create a basic HTML document
  • Create a script tag on the document head element
  • Add the following html code
<!DOCTYPE html>
<html>
<head>
<title>Events</title>
</head>
<body>
<button id="firstButton">Click Me!!</button>
<button id="secondButton">Remove event listener</button>
<a href="https://google.com">Link with JavaScript handler</a>
</body>
</html>
  • Select the firstButton id element using querySelector method
  • When the user clicks this button will see an alert message with the following message:
You clicked an event listened element
  • Use addEventListener to add this functionality
  • Add other event listener to this button reading the doc and using your imagination!