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

233
Views
Changing event.target.value in the onChange event, then using checkValidity() but does not work

Hello I need to change the event.target.value with an input and that input has 8 character min rule. I'm currently doing like this(example) in a component react js:

              <input
              ...
              minLength={8}
              onChange={(e) => {
                onChangeHandler(e);
              }}

          />

Where in the onChangeHandler i'm doing this

e.target.value = 'less8';
console.log(e.target.checkValidity());

However when i call checkValidity it's returning 'true', but i was expecting 'false'.

I debugged this and it's because when i assigned a value into 'e.target.value' the function 'e.target.checkValidity()' does not work anymore.

Does anyone have another way to assign a value to 'e.target.value' and still make 'checkValidity()' work?

about 4 years ago · Juan Pablo Isaza
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!