i have using<input type="number">
. in that i don't want user can enter manually numbers in to input. user only increase and decrees numbers by step then is it possible.
i have using<input type="number">
. in that i don't want user can enter manually numbers in to input. user only increase and decrees numbers by step then is it possible.
- Try this: Spinner - jQuery UI – pes502 Commented Jun 24, 2014 at 7:45
- 1 I don't think it's possible to disable one particular function of an element like that, but it certainly would be possible to replicate by creating two buttons of your own and making the input read only. – scragar Commented Jun 24, 2014 at 7:46
3 Answers
Reset to default 13You can do it by cancelling the keydown
event. Either inline (<input type="number" onkeydown="return false">
), or within an event handler.
Use jQuery
$('input[type="number"]').keydown(function (e) {
e.preventDefault();
});
Use readonly
attribute to input.
<input type="number" readonly>
Demo