Fixed disabled button
This commit is contained in:
		
							parent
							
								
									e77468106d
								
							
						
					
					
						commit
						27ae2aeb48
					
				@ -85,7 +85,7 @@ button {
 | 
			
		||||
    margin: 1em 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
button[disabled=true] {
 | 
			
		||||
button:disabled {
 | 
			
		||||
    background-color: #d9d9d9;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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', {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user