Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is possible to make html input type number only show numbers which are multiple of 5

Tags:

html

input

Is it possible to make html input type number shows only numbers which are multiple of 5 (5,10,15....)?

    <input type="number" name="pax">
like image 259
Jacob Avatar asked Oct 21 '25 11:10

Jacob


1 Answers

For HTML 5 only

<input type="number" name="pax" step="5">

There are other javascript or regex solutions but they shouldn't be necessary.

Further reading on type input: http://www.w3schools.com/html/html_form_input_types.asp

Here is an example using some more popular attributes of number inputs.

<input type="number" name="pax" min="0" max="100" step="5" value="0">
like image 60
Brennen Sprimont Avatar answered Oct 23 '25 07:10

Brennen Sprimont



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!