Use html5 pattern attribute for inputs:
<input type="text" pattern="\d*" title="Only digits" />
OR
Use html5 number type for input :
<input type="number" />
More Related Contents:
- how to view the answer of a js function in a html input? [duplicate]
- Java script on focus instead of onclick
- Set the value of an input field
- Can I hide the HTML5 number input’s spin box?
- How to get the raw value an field?
- onchange event on input type=range is not triggering in firefox while dragging
- How to get current formatted date dd/mm/yyyy in Javascript and append it to an input [duplicate]
- How do you get the cursor position in a textarea?
- HTML input type=”number” still returning a string when accessed from javascript
- Remove a FileList item from a multiple “input:file”
- Get list of all input objects using JavaScript, without accessing a form object
- Putting default value in
- Why can’t I get the input from the input box?
- How to get text of an input text box during onKeyPress?
- Change HTML form ‘input’ type by JavaScript
- Check if input is number or letter javascript
- Delete default value of an input text on click
- Set the default value of an input field
- html() vs innerHTML jquery/javascript & XSS attacks
- New Webkits convert decimal comma to ~ dot and vice versa in number-type inputs. Javascript name of that browser feature?
- Disable spaces in Input, AND allow back arrow?
- HTML form input tag name element array with JavaScript
- How to show Page Loading div until the page has finished loading?
- Getting Bootstrap’s modal content from another page
- Enter key press behaves like a Tab in Javascript
- React.js this.props.data.map() is not a function
- How to store a byte array in Javascript
- html5/Javascript – How to get the Selected folder name?
- Split text into pages and present separately (HTML5)
- Can you have multiple lines in an element?