How do I make an input box accept numbers only?

Yeah, I feel for you, regular expressions sure is a bit awkward in the beginning. But I do encourage you to pursue learning at least the basics. Learn Regex the Easy Way looks like a good starting point.


Tools like https://regex101.com are helpful when trying to understand a regular expressions by breaking them up into smaller pieces.

But I’m too much of a beginner to know how to use css code. I threw it at the bottom of my style.css file and nothing happened.

Sorry about that, I didn’t verify the CSS. It looks like Firefox is a special snowflake. That’s what so charming with browsers, they don’t always work the same way. Append this snippet of CSS as well:

input[type=number] {
  -moz-appearance: textfield;
}
3 Likes