Fixed disabled button

This commit is contained in:
John Shaver 2018-09-13 00:39:33 -07:00
parent e77468106d
commit 27ae2aeb48
2 changed files with 15 additions and 1 deletions

View File

@ -85,7 +85,7 @@ button {
margin: 1em 0;
}
button[disabled=true] {
button:disabled {
background-color: #d9d9d9;
}

View File

@ -129,6 +129,20 @@ function init() {
console.log(pair);
submitCode(pair);
});
var formElements = document.querySelector('.js-submit').elements;
for(var i = 0; i < formElements.length; ++i) {
var tosCheck = document.querySelector('[name=telebit-agree]');
var leCheck = document.querySelector('[name=letsencrypt-agree]');
var pairCodeInput = document.querySelector('[name=pair-code]');
formElements[i].addEventListener('input', function(ev) {
if(tosCheck.checked && leCheck.checked && pairCodeInput.value.length) {
document.querySelector('.js-submit button').disabled = false;
} else {
document.querySelector('.js-submit button').disabled = true;
}
});
};
}
window.fetch('https://' + location.hostname + '/_apis/telebit.cloud/index.json', {