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.