Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion random-password/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Password Length
</div>
<div class="right">
<input type="number" name="" id="total-char" max="30" min="2" value="10" />
<input type="number" id="total-char" max="30" min="4" value="10" />
</div>
</div>
<div class="row">
Expand Down
12 changes: 12 additions & 0 deletions random-password/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,19 @@ const lowerInput = document.getElementById("lower-case")
const numberInput = document.getElementById("numbers")
const symbolInput = document.getElementById("symbols")

const inputField = document.getElementById('total-char');

inputField.addEventListener('input', function() {
const min = parseInt(inputField.min);
const max = parseInt(inputField.max);
let value = parseInt(inputField.value);

if (value < min) {
inputField.value = min;
} else if (value > max) {
inputField.value = max;
}
});

const getRandomData = (dataSet) => {
return dataSet[Math.floor(Math.random() * dataSet.length)]
Expand Down