Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react onSubmit get form values

handleSubmit = (event) => {
  event.preventDefault();
  console.log(event.target.elements.username.value) // from elements property
  console.log(event.target.username.value)          // or directly
}

<input type="text" name="username"/> 
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #react #onSubmit #form #values
ADD COMMENT
Topic
Name
5+8 =