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

127
Views
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 answers
Answer question

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 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!