1var check = function() {
2 if (document.getElementById('password').value ==
3 document.getElementById('confirm_password').value) {
4 document.getElementById('message').style.color = 'green';
5 document.getElementById('message').innerHTML = 'matching';
6 } else {
7 document.getElementById('message').style.color = 'red';
8 document.getElementById('message').innerHTML = 'not matching';
9 }
10}
11let pattern = new RegExp("^(?=(.*[a-zA-Z]){1,})(?=(.*[0-9]){2,}).{8,}$"); //Regex: At least 8 characters with at least 2 numericals
12 let inputToListen = document.getElementById('pass-one'); // Get Input where psw is write
13 let valide = document.getElementsByClassName('indicator')[0]; //little indicator of validity of psw
14
15 inputToListen.addEventListener('input', function () { // Add event listener on input
16 if(pattern.test(inputToListen.value)){
17 valide.innerHTML = 'ok';
18 }else{
19 valide.innerHTML = 'not ok'
20 }
21 });
1let pattern = new RegExp("^(?=(.*[a-zA-Z]){1,})(?=(.*[0-9]){2,}).{8,}$"); //Regex: At least 8 characters with at least 2 numericals
2 let inputToListen = document.getElementById('pass-one'); // Get Input where psw is write
3 let valide = document.getElementsByClassName('indicator')[0]; //little indicator of validity of psw
4
5 inputToListen.addEventListener('input', function () { // Add event listener on input
6 if(pattern.test(inputToListen.value)){
7 valide.innerHTML = 'ok';
8 }else{
9 valide.innerHTML = 'not ok'
10 }
11 });
1var check = function() {
2 if (document.getElementById('password').value ==
3 document.getElementById('confirm_password').value) {
4 document.getElementById('message').style.color = 'green';
5 document.getElementById('message').innerHTML = 'matching';
6 } else {
7 document.getElementById('message').style.color = 'red';
8 document.getElementById('message').innerHTML = 'not matching';
9 }
10}
1var strongRegex = new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#\$%\^&\*])(?=.{8,})");
2