Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react form submit values with name

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 #form #submit #values
ADD COMMENT
Topic
Name
3+2 =