Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to remove the increase/decrease arrows in input type="number" for textboxfor?

Is there any way to remove these in input (type="number")?

<input type="number" />

It's for the users to input their phone numbers.

this

like image 837
Victor Zyon Tiangson Avatar asked Jan 25 '18 12:01

Victor Zyon Tiangson


People also ask

How do you remove increase and decrease arrows in input?

Using inputmode=”numeric” attribute you can find an input box without an arrow. The older browsers might not support this feature for example Internet Explorer and Safari but most of the modern browsers like Chrome, Firefox, Edge, Opera support this attribute.

How do I hide the number arrows?

If you want to hide arrow buttons of the HTML <input> element with the “number” type, you need to use CSS. As there is no longer a problem in Chrome, you can only set the display property to “none” to hide the arrow buttons.

How do I remove the input number arrows from Firefox?

If you don't want the spin arrows, then don't use type="number" . You can use type="text" and the pattern attribute to set a regex to make sure it's a number.


2 Answers

This can be done through CSS if you wish,

input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin: 0; 
}
<input type="number" />

Hope this helps!

like image 66
sanatsathyan Avatar answered Sep 30 '22 11:09

sanatsathyan


Just these was enought for my code.

.input[type=number] {  
   &::-webkit-inner-spin-button{ display: none; }
   -moz-appearance:textfield;
}
like image 23
Oscar Jovanny Avatar answered Sep 30 '22 13:09

Oscar Jovanny