
Design comparison
SolutionDesign
Community feedback
- P@taceseptPosted 26 days ago
Hey! Your input allows any characters, which can cause issues. Use <input type="text"> and restrict input to numbers with this JS:
input.addEventListener("input", (e) => { e.target.value = e.target.value.replace(/[^0-9.]/g, ""); });
This prevents non-numeric input without needing <input type="number"> or worrying about arrows. 🚀
0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord