The example in this article describes the jQuery random password generation method. Share it with everyone for your reference. The specific implementation method is as follows:
$.extend({
Password: function (length, special) {
var iteration = 0;
var password = "";
var randomNumber;
If(special == undefined){
var special = false;
}
While(iteration < length){
randomNumber = (Math.floor((Math.random() * 100)) % 94) 33;
if(!special){
If ((randomNumber >=33) && (randomNumber <=47)) { continue; }
If ((randomNumber >=58) && (randomNumber <=64)) { continue; }
If ((randomNumber >=91) && (randomNumber <=96)) { continue; }
If ((randomNumber >=123) && (randomNumber <=126)) { continue; }
}
iteration ;
Password = String.fromCharCode(randomNumber);
}
Return password;
}
});
// How to use
$.password(8);
$.password(12, true);
I hope this article will be helpful to everyone’s jQuery programming.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn