Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to always show up/down arrows for input "number"?

I want to always show up/down arrows for input "number" field. Is this possible? So far I haven't had any luck...

http://jsfiddle.net/oneeezy/qunbnL6u/

HTML:

<input type="number" /> 

CSS:

input[type=number]::-webkit-inner-spin-button,  input[type=number]::-webkit-outer-spin-button {       -webkit-appearance: "Always Show Up/Down Arrows";  } 
like image 625
Oneezy Avatar asked Aug 08 '14 01:08

Oneezy


People also ask

How do you avoid input arrow numbers?

Using inputmode=”numeric” attribute you can find an input box without an arrow.

How do I allow only input field numbers?

By default, HTML 5 input field has attribute type=”number” that is used to get input in numeric format. Now forcing input field type=”text” to accept numeric values only by using Javascript or jQuery. You can also set type=”tel” attribute in the input field that will popup numeric keyboard on mobile devices.


1 Answers

You can achieve this (in Chrome at least) by using the Opacity property:

input[type=number]::-webkit-inner-spin-button,  input[type=number]::-webkit-outer-spin-button {       opacity: 1;  } 

As stated above, this will likely only work in Chrome. So be careful using this code in the wild without a fallback for other browsers.

like image 68
BJack Avatar answered Sep 19 '22 19:09

BJack