Last active
December 31, 2015 10:58
-
-
Save mcraz/7976178 to your computer and use it in GitHub Desktop.
Accept numeric input only using JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onkeypress="if ( isNaN( String.fromCharCode(event.keyCode) )) return false;" | |
Example Use : <input type="text" name="length" value="" class="form-control " placeholder="Video Duration (in seconds)" autocomplete="off" onkeypress="if ( isNaN( String.fromCharCode(event.keyCode) )) return false;"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment