diff --git a/09_random_password_gen/app.js b/09_random_password_gen/app.js index 4437625..5ac9afa 100644 --- a/09_random_password_gen/app.js +++ b/09_random_password_gen/app.js @@ -1,5 +1,8 @@ const passwordBox = document.getElementById("password"); -const length = 12; +let length = 6; // Initialize length variable with default value + +const passwordLengthSlider = document.getElementById('passwordLength'); +const lengthValue = document.getElementById('lengthValue'); const upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const lowerCase = "abcdefghijklmnopqrstuvwxyz"; @@ -8,6 +11,13 @@ const symbol = "@#$^&*()_+~}{[]<>?-="; const allChars = upperCase + lowerCase + number + symbol; +///for password length +// Event listener for password length slider +passwordLengthSlider.addEventListener('input', function() { + length = parseInt(this.value); // Update length variable + lengthValue.textContent = length; // Update displayed value +}); + ////for creating password function createPassword() { password = ""; @@ -48,4 +58,5 @@ function showCopyMessage() { setTimeout(() => { copyMessage.style.display = "none"; }, 3000); -} \ No newline at end of file +} + diff --git a/09_random_password_gen/index.html b/09_random_password_gen/index.html index d8ccbbc..4d43411 100644 --- a/09_random_password_gen/index.html +++ b/09_random_password_gen/index.html @@ -15,7 +15,14 @@