Password Generator using JavaScript
Hello Coders! Welcome to JS Project Blog. In this, we're going to see how to create a Random Password Generator using jQuery and JavaScript. You might have used the Chrome "Use Suggested Password" feature, which suggests you random password of chara...
creo-codigo.hashnode.dev3 min read
$("#namer input").on("change keyup paste", function() { var inputValue = $(this).val();
if (inputValue) { $(".namer-controls").addClass("active"); $("#namer").addClass("active"); } else { $(".namer-controls").removeClass("active"); $("#namer").removeClass("active"); }});
$(document).on("click", ".namer-controls.active span", function() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; var len = document.getElementById("length").value; for( var i=0; i < len; i++ ){ text += possible.charAt(Math.floor(Math.random() * possible.length)); } $("#namer input").val(text); });
$(document).ready(function() { $("#namer-input input").focus(); });