Click Counter Lab

Easy
52
1
77.6% Acceptance

In this lab, you will create a basic Click Counter app using JavaScript. When a user clicks the button, the count should increment and display the updated count inside the paragraph.

Use JavaScript and event listeners to achieve this functionality. Initial count should be 0

counter gif

Steps

  1. Create a button having id counter-btn and add Click me! text to the button

  2. Create a paragraph with id count-display and add the text 0 to the paragraph element

  3. In the script.js file, add a click event listener to #counter-btn , which fetches the current number in the #count-display and increments the count. The incremented count should be added back to the #count-display