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

132
Visualizações
How to tell to <input type=password>ConfirmationPassword</input> when it can be :valid AFTER it is = to <input>Password

i have stuck with this. Just can't find how to manipulate JS and trick validation.

I wanna to trigger this - onkeyup when <input2 pwd> which is = to <input pwd>

.l_input:valid + span::after {
position: absolute;
content: '✓';
color: #009000;
font-size: 1vw;}

And this is my supper duper js

var check = function() {
  if (document.getElementById('password').value == document.getElementById('c_password').value) {
      document.getElementById('validity').is(':valid'); //FORCE :VALID
  } else {document.getElementById('validity').is(':invalid');   // :INVALID 
}}  // 'validity' is span

Now css triggers after any symbol (coz it doesnt have pattern)

HTML:

<input onkeyup="check()" type=password id=password placeholder='Password'>
<input onkeyup="check()" type=password id=c_password placeholder='Confirmation Password'>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

SOLUTION:

function check() {
            if (document.getElementById('password').value == document.getElementById('c_password').value) {
                document.getElementById('c_password').setCustomValidity('');
            } else {document.getElementById('c_password').setCustomValidity('Not matching');   }
            }

This ^ JS makes document.getElementById('c_password') <INPUT> Invalid until i say.

In this way CSS :valid // :invalid works the way i SET IT.

Which is less coding just few additional lines.

NOTE ! :

setCustomValidity('') // no string = valid
setCustomValidity('Not matching') // string is not displayed
about 4 years ago · Juan Pablo Isaza Relatório
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