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
Password Validations using regex

function ValidatePassword() {

    var rules = [{
            Pattern: "[a-zA-Z]",
            Target: "UpperCase"
        },

        {
            Pattern: "[0-9]",
            Target: "Numbers"
        },
        {
            Pattern: "[!@@#$%^&*]",
            Target: "Symbols"
        }
    ];

    var password = $("#password").val();
    
    $("#Length").removeClass(password.length > 6 ? "fa-times" : "fa-check");
    $("#Length").addClass(password.length > 6 ? "fa-check" : "fa-times");
    for (var i = 0; i < rules.length; i++) {
        $("#" + rules[i].Target).removeClass(new RegExp(rules[i].Pattern).test(password) ?
            "fa-times" :
            "fa-check");
        $("#" +
            rules[i].Target).addClass(new RegExp(rules[i].Pattern).test(password) ? "fa-check" :
            "fa-times");
    }
} 
$(document).ready(function () {
    $("#password").on('onkeypress', ValidatePassword)

});
Validations not work according to rules and pattern ..... and i am using the onkrypress and these validations shows when page is reload..
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When you use .on() you should define your event without 'on' keyword replace onkeypress with keypress

$("#password").on('keypress', ValidatePassword)

or:

$("#password").keypress(ValidatePassword)
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!