-1

Need to validate HTML5 textbox should accept only numeric values from 0-9

I tried using patterns .It didn't worked out

  • Does this answer your question? [How to make HTML input tag only accept numerical values?](https://stackoverflow.com/questions/13952686/how-to-make-html-input-tag-only-accept-numerical-values) – Ivar Feb 17 '21 at 10:10

1 Answers1

-1

Following piece of code fixed the issue

<input type="text" id="txtValue" maxlength="7" onkeypress="return (event.charCode == 8 || event.charCode == 0 || event.charCode == 13) ? null : event.charCode >= 48 && event.charCode <= 57" name="txtitems" runat="server" />