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

172
Views
why the input value shows a type of string instead of type of number?

I am trying to get the input value type of number. But the value keep showing me its a type of string. How do i fix this?

const [price, setPrice] = useState();

const handlePrice = (event) => {
    console.log(event.target.value);
    setPrice(event.target.value);
};

        <div className="col-md-6">
          <label for="inputPrice" className="form-label">
            Price
          </label>
          <input
            value={price}
            onChange={handlePrice}
            type="number"
            className="form-control"
            id="inputPrice"
          />
        </div>
        <div className="col-12">
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

const handlePrice = (event) => {
    console.log(event.target.value);
    // setPrice(parseInt(event.target.value));
    // setPrice(event.target.value * 1);
    setPrice(Number(event.target.value));
};
almost 4 years ago · Santiago Trujillo 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!