Skip to content

Instantly share code, notes, and snippets.

@vc7
Last active December 19, 2015 11:29
Show Gist options
  • Select an option

  • Save vc7/5947834 to your computer and use it in GitHub Desktop.

Select an option

Save vc7/5947834 to your computer and use it in GitHub Desktop.
Use regular expression to restrict user's input value.
<input type="text" onkeyup="value=value.replace(/[^-_0-9]/g,'')">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment