I have a form and I need to make sure the password meets some specific standards. It has to have atleast one.uppercase, one.lowercase, one number and be atleast 8 characters long. Here's what I've come up with so far, but im a bit stuck. Help?
jQuery(document).ready(function() {
jQuery("#mysubmit").attr('disabled', 'disabled');
jQuery("form").keyup(function() {
// To Disable Submit Button
jQuery("#mysubmit").attr('disabled', 'disabled');
// Validating Fields
var name = jQuery("#name").val();
var email = jQuery("#email").val();
var password = jQuery("#mypassword").val();
console.log('1');
if (!(name == "" || email == "" || password.length < 8 && value == function(char) {
return !!/[A-Z]/.exec(char[0]);
}; )) {
jQuery("#mysubmit").removeAttr('disabled');
jQuery("#mysubmit").css({
"cursor": "pointer",
"box-shadow": "1px 0px 6px #333"
});
}
});
console.log('5');
// On Click Of Submit Button
jQuery("#mysubmit").click(function() {
jQuery("#mysubmit").css({
"cursor": "default",
"box-shadow": "none"
});
alert("Form Submitted Successfully..!!");
});
});
if (!(name == "" && email == "" && password.includes("^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$")))
解决了
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.