Prevent padLength from getting below 1 when generating

This commit is contained in:
Robbie Antenesse 2018-02-21 10:13:01 -07:00 committed by Robbie Antenesse
parent de69f9e9b6
commit 0a543a4f33
1 changed files with 5 additions and 0 deletions

View File

@ -65,6 +65,11 @@ window.onload = () => {
document.getElementById('decrypted').innerHTML = output;
}
document.getElementById('padLength').oninput = (event) => {
const value = parseInt(event.target.value);
if (value < 1) event.target.value = 1;
}
document.getElementById('generatePad').onclick = () => {
const input = parseInt(document.getElementById('padLength').value, 10);
const output = generatePad(input);