counter-app

My app is basically an increment and decrement of numbers where you tap buttons

counter-app

Created At

ETHOnline 2025

Project Description

A beginner-friendly JavaScript project that lets you increase, decrease, and reset a number with a clean and modern interface. Built with HTML, CSS, and vanilla JavaScript, it’s perfect for learning DOM manipulation and event handling.

✨ Features

πŸ”Ό Increase / Decrease buttons to adjust the counter

πŸ” Reset button to return to zero

🎨 Dynamic color changes (green for positive, red for negative)

πŸ’» Built using pure JavaScript (no frameworks required)

πŸ“± Responsive design that works on both desktop and mobile

πŸš€ How to Run

Download or clone the repository

Open the index.html file in your browser

Click the buttons to interact with the counter

🧠 What You’ll Learn

DOM selection (getElementById)

Event listeners (addEventListener)

Dynamic style and text updates

Basic project structure and Git/GitHub usage

πŸ“œ License

This project is open-source under the MIT License β€” feel free to use, modify, and share it.

How it's Made

his project was built using only three core web technologies:

HTML for the structure of the page

CSS for styling and layout

JavaScript for functionality and interactivity

πŸ—οΈ Step-by-Step Breakdown

Created the HTML file (index.html)

Added a title, a heading, and three buttons: Increase, Decrease, and Reset.

Added a <div> to display the counter value.

Linked the JavaScript file at the bottom of the page with:

<script src="script.js"></script>

Styled it using inline CSS inside the <style> tag

Used Flexbox to center everything in the middle of the page.

Added a soft gradient background for a clean, modern look.

Styled the buttons with hover effects and rounded corners.

Wrote the logic in JavaScript (script.js)

Created a variable count to hold the current number.

Used document.getElementById() to get the buttons and counter display.

Added event listeners for button clicks:

Increase β†’ adds +1 to the count.

Decrease β†’ subtracts 1 from the count.

Reset β†’ sets the count back to 0.

Updated the display text and changed its color dynamically (green if positive, red if negative, black if zero).

Tested the app in a browser

Opened index.html directly in Chrome.

Clicked the buttons to make sure everything worked smoothly.

🧩 Tools Used

πŸ–‹οΈ VS Code – for writing and editing code

🌐 Google Chrome – for testing and previewing

🧠 Vanilla JavaScript – no external libraries or frameworks

background image mobile

Join the mailing list

Get the latest news and updates