disable submit button if input is empty
document.getElementById('submitID').disabled = true; //Disable at first
//Listen for keyup event (after we hit a key)
//-----------------------------------------------------------
//NOTE: We can also use the change event, but the submit button
// won't update until we finish typing the whole thing
//-----------------------------------------------------------
document.getElementById('myInputFieldID').addEventListener('keyup', e => {
//Check for the input's value
if (e.target.value == "") {
document.getElementById('submitID').disabled = true;
}
else {
document.getElementById('submitID').disabled = false;
}
});
//Happy coding :)