Question

I'm designing an html page for WiFi authentication and I would like to introduce in this page a Checkbox and Submit button, upon reading the Terms and Condition and Checking the CheckBox, the Submit button will be active.

Is this doable?

thanks,

Was it helpful?

Solution

<html>
<head>
<script>
 function disableSubmit() {
  document.getElementById("submit").disabled = true;
 }

  function activateButton(element) {

      if(element.checked) {
        document.getElementById("submit").disabled = false;
       }
       else  {
        document.getElementById("submit").disabled = true;
      }

  }
</script>
</head>

<body onload="disableSubmit()">
 <input type="checkbox" name="terms" id="terms" onchange="activateButton(this)">  I Agree Terms & Coditions
<br><br>
  <input type="submit" name="submit" id="submit">
</body>
</html>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top