P
P
Pavel_Proca2016-11-06 19:57:55
css
Pavel_Proca, 2016-11-06 19:57:55

How to make a field for entering numbers only?

I know that it can be written like this:
<input type="number">
But with this method, arrows appear on the side 3120f1cb104c40ac9009756ba3645caa.png, which terribly spoil the appearance. How can I make it so that they would not be, but at the same time it was possible to enter only numbers?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Yarkov, 2016-11-06
@Pavel_Proca

<input type="text" oninput="this.value = this.value.replace(/[^0-9]/g, '')">

https://jsfiddle.net/w0mzddcw/

K
Kirill Netesin, 2016-11-06
@knetesin

You can use any mask input plugin (search for example "javascript mask"):
For example ,
This
or this
, etc., there are a lot of them available, for every taste and color :)

Z
zooks, 2016-11-06
@zooks

The normal way is to do it through
A, the arrows can be easily removed:
stackoverflow.com/questions/3790935/can-i-hide-the...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question