Click Counter Lab
Easy
61
1
63.4% 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
Steps
-
Create a button having id
counter-btn
and addClick me!
text to the button -
Create a paragraph with id
count-display
and add the text0
to the paragraph element -
In the
script.js
file, add aclick
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