CSS: Hide “spinners” (up/down arrows) on inputs with type=”number” using a class

Quick (and potentially dirty) CSS fix for getting rid of “spinners” in input boxes that are type=”number” using a class to restrict the change to just one input element instead of every input in your app.

These little arrows look different on every browser (or they used to, anyway – they look pretty consistent across Chrome, Firefox, and Safari nowadays).  There’s no one-size-fits-all fix for hiding them because different browsers handle them differently.

Screen Shot 2016-04-08 at 7.35.23 AM
These ugly little things don’t even fit properly in the default input field on my browser!

Anyway, here’s the code I’ve recycled across a couple projects now to get rid of them:

JSFiddle: https://jsfiddle.net/faz7wm43/1/
Tested in Firefox 31, Chrome 48, Safari 9.0.3 on Mac and Chrome 48 on iPhone.

/* hide up/down arrows ("spinners") on input fields marked type="number" */
.no-spinners {

.no-spinners::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;

Put the no-spinners class on your input themselves.

<input type="number" class="no-spinners"/>

Full disclosure: I didn’t test this on IE.

JavaScript and Regex: Using a regular expression and .replace() to strip (foo) from a string

Here’s a quick tutorial on using regular expressions in JavaScript to edit a string and return the modified result. My strings looked like this:

"Toyota (1999 - 2005)"
"Ford (1995 and up)"
"Honda (up to 2015)"
"Kia or Chevy (any)

In this case, each string was the name property on an object. (Ie: you’re not looking at an array of strings in the example above.)

For display purposes, I wanted to show (in my app’s template) only what came before the first parenthesis, like so:

Kia or Chevy

Thanks to guide on how to use regex to remove everything after a particular character, and this refresher on how .replace() works, I had this problem solved in a matter of minutes with the following expression, where params[0] is the string (more about why my method looks like this after the code):

export function stripParensFromCarData(params/*, hash*/) {
  return params[0].replace(/\(.*\)/,'');

I used this method in an Ember helper I wrote to format strings for display in a handlebars template. The helper was hooked up like so in the .hbs file:

{{strip-parens-from-car-data carString}}

My favorite tool for testing regular expressions as I write them is regexr.com.