Search code examples
htmlradio-buttonsubmit-button

Why doesn't the Radio Button enable the disabled Submit button


Should be a Standard HTML5 Question, but for the life of me I can't find a straight forward answer.

When I have the following code (snipped but tested in jsfiddle):

<form>
   <input type="radio" name="color" value="black" required />
   <input type="radio" name="color" value="white" />
   <input type="submit" value="Click Here" disabled="disabled"/>
</form>

I do not have the ability to click the button after the radio button has been chosen. Searching for almost an hour for an answer (could be my google-foo is waning).


Solution

  • disabled is a html attribute,as it can not be applied with a condition.It permanently disable the element until the attribute is removed.It is good to use angular's 'ng-disabled'.https://docs.angularjs.org/api/ng/directive/ngDisabled