Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

input should reject non-alphabetical input reacj js

onChangeAlphaNumericInput(e) {
  const value = e.target.value;
  const regex = /^[0-9a-zA-Z(-)]+$/; //this will admit letters, numbers and dashes
  if (value.match(regex) || value === "") {
    this.setState({ inputValue: value });
  }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #input #reject #input #reacj #js
ADD COMMENT
Topic
Name
2+6 =