5

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,

6
  • Of Course its Doable .. Look into Javascript .. <br> stackoverflow.com/questions/8394562/… Commented Feb 3, 2014 at 9:38
  • Are you using any JS framework ? Anyway I think you shoud search google for this and found millions of answers ^^ Commented Feb 3, 2014 at 9:39
  • Hello, not I'm not using any JS.. it's only html code Commented Feb 3, 2014 at 9:41
  • The link you provided it doesn't work... nothing it shows in the HTML page :) Commented Feb 3, 2014 at 9:44
  • I have tried all of this, non of them are working:( Commented Feb 3, 2014 at 9:49

1 Answer 1

12
<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 & Conditions
  <input type="submit" name="submit" id="submit">
</body>
</html>
Sign up to request clarification or add additional context in comments.

10 Comments

Thank you very much for your fast response, yes this is what I'm intended to do.. highly appreciated your efforts.
Hello, I have noticed the button is enabled as soon as the page loaded... it will be disabled only upon clicking/activating the CheckBox...
So you want the checkbox will be checked when the page is loaded. right?
when the page is loaded the checkbox should be unchecked and the submit button should be disabled as well. do you want me to share the whole code with you?
Thats what we are doing. right? Share me the code So that i can do modifications directly.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.