Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

240
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda