Created
March 26, 2015 16:05
-
-
Save majidmushtaq91/fd73b25f0c044c05bada to your computer and use it in GitHub Desktop.
Javascript validate password limit and special characters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function () { | |
$("#password").blur(function () { | |
var valid = /^[ A-Za-z0-9@.?(),!/-]*$/ | |
if($(this).val().length < 8 || $(this).val().length > 12 ) { | |
console.log("Please enter password between 8-12"); | |
return false; | |
} | |
if(!valid.test($(this).val())){ | |
console.log("This special character is not allowed"); | |
return false; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment