02. Event Listener πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

πŸ—οΈ Implement Event Handler on Mouse Click

Work with a partner to implement the following user story:

  • As a developer, I want to increment or decrement a count when a user clicks on a button.

Acceptance Criteria

  • It’s done when a user clicks on the increment button and the count is increased by 1.

  • It’s done when a user clicks on the decrement button and, if the count is greater than 0, the count is decreased by 1.

Assets

The following animation demonstrates the web application’s appearance and functionality:

As the user selects the Decrement and Increment buttons, the Current Count number decreases and increases respectively.


πŸ’‘ Hints

What method can we use to listen for an mouse click?

πŸ† Bonus

If you have completed this activity, work through the following challenge with your partner to further your knowledge:

  • A click is just one type of DOM event. What are some others?

Use Google or another search engine to research this.


βœ… Solutions

Solutions Click Here