Input type="number" accepts dashes -- HTML -


i've got:

<td><input type="number" min="0" style="width: 3em" data-bind="value: $data.qty" /></td> 

which accepts '-56' number. i'd disable other character other numbers.

i've seen post (make html5 input type=“number” accepting dashes) opposite of want.

which kind of input type should use, instead of having write patterns etc?

js:

<input type="text" onkeypress='return event.charcode >= 48 && event.charcode <= 57'></input> 

html 5:

<input type = "number"> 

Comments