Is it possible to prohibit the input of a number in <input type="number"> so that they can use only up / down arrows?

 input[type=number]::-webkit-inner-spin-button { opacity: 1; } 
 <input type="number" value="10" min="10"> 

  • An input field in which nothing can be entered is strange, you can add the readonly attribute. - pavel
  • @pavel not, he means input type with arrows only - dirkgntly 5:26 pm
  • one
    @dDevil answer went for revision, or with the ends was removed? I wanted to write that for inline JS (even if only for the sake of brevity) it is supposed to be shot, but did not have time. I don’t know about tablets (there’s nothing to test), but on a computer it seems to have enough input and paste event handling: jsfiddle.net/994u8aru . - Regent
  • @Regent decided to remove, because the solution is not suitable for mobile phones - dirkgntly
  • @dDevil and what about my option? Doesn't work on mobile devices too? - Regent

1 answer 1

Javascript option:

 <input type="number" id="check"/> <script> document.getElementById('check').onkeypress = function (e) { return false; } </script> 

Or so:

 <input type="number" id="check" onkeypress="return false"/>