Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
How event.target.name.value works

So i've been trying to use event.target.name.value for an input field but when i submit the form, the values are null and i have to click twice to get the values. Here is my code:

const [name, setName] = useState('');
const handleSubmit = (event)=> {
  setName = event.target.name.value;
  console.log(name);
}

What am i doing wrong?

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You are setting the function which is wrong. you need to pass it as parameter to setName function.

const [name, setName] = useState('');
console.log(name);
const handleSubmit = (event)=> {
  setName(event.target.value);
  
}

about 4 years ago · Juan Pablo Isaza Report

0

brother event.target.name.value it will take the value from your targeted input like name is a

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!