To allow HTML5 input type = ”number” to accept dashes, use a regular expression.
Add the regular expression in the pattern attribute as shown below.
[ 0 - 9 ] + ([ - \, ] [0 - 9] + ) ? "
Add it to the code now:
input type = "text" pattern = "[0-9]+([-\,][0-9]+)?" name = "my-num" title = "dashes or comma"/>
The above will allow you to add dashes in number. However, above you need to use input type text for the solution to work.