A clean, real-time tip calculator that handles bill splitting across multiple people with instant feedback and input validation โ built with vanilla JS.
Manually splitting bills and calculating tips at a restaurant is error-prone and slow, especially across larger groups with custom tip percentages.
Built a reactive vanilla JS form that recalculates the per-person tip and total on every input change. Input validation guards against divide-by-zero and non-numeric entries. A reset button clears all fields instantly.
Pure vanilla JS with event listeners on each input field triggering a central calculate() function. Controlled inputs feed a tip-per-person and total-per-person formula: tipAmount = (bill ร tipPercent / 100) / numPeople. Input validation checks for empty fields, zero people (prevents division by zero), and negative values before rendering results. CSS custom properties manage the color theme; no framework needed.
None.
None.