15

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

Russia Must Remove Putin
  • 374,368
  • 89
  • 403
  • 331
  • Since you title includes `TextBoxFor()` I can only assume you have not tagged this correctly (should be [tag:asp.net-mvc]). But `TextBoxFor()` will never add `type="number"`. Only `EditorFor()` can add that, and only if the property is a numeric type - and a phone number property should never be a numeric type - it needs to be a `string` (using css for this is just crazy) –  Jan 25 '18 at 22:01
  • 1
    Possible duplicate of [Can I hide the HTML5 number input’s spin box?](https://stackoverflow.com/questions/3790935/can-i-hide-the-html5-number-input-s-spin-box) – isherwood Apr 24 '19 at 16:48
  • now a days you can use – Suresh Kumar Aug 31 '20 at 15:08

3 Answers3

29

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!

sanatsathyan
  • 1,713
  • 12
  • 18
2

Just these was enought for my code.

.input[type=number] {  
   &::-webkit-inner-spin-button{ display: none; }
   -moz-appearance:textfield;
}
Oscar Jovanny
  • 1,077
  • 8
  • 6
0

This worked for me:

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

Thanks:)

Zsolt
  • 11
  • 1
  • Welcome to StackOverflow. Please provide some description / reasoning why do you think your proposed solution might help the OP. – Peter Csala Aug 31 '21 at 13:34
  • Please provide additional details in your answer. As it's currently written, it's hard to understand your solution. – Community Aug 31 '21 at 13:34