$('#passwordLength, .cmpoe').change(function() { buildCatalog(); generatePassword(); }); $('form input').keydown(function(event){ if(event.keyCode === 13) { event.preventDefault(); buildCatalog(); generatePassword(); } }); $(function() { buildCatalog(); generatePassword(); }); $('#copy').click(function() { $('#password').select(); }); $('#password').click(function() { $('#password').select(); }); $('#generate').click(function() { generatePassword(); }); const comp = { uppercase: true, lowercase: true, numbers: true, symbols: true }; let passwordLength = 15; let catalog = ''; function generatePassword() { let password = ''; for(let i = 0; i < passwordLength; i++) { password += generateChar(); } $('#password').text(password); $('#history').append(`