I would like to disable an input field from being click-able if user hasn't selected a radio button. Here is the simple HTML form:
<form method="POST">
<input type='radio' name='a' value='a' id='checkMe' /> a
<input type='radio' name='a' value='b' id='checkMe' /> b
<input type='radio' name='a' value='c' id='checkMe' /> c
<input type='submit' value='choose' id='choose' disabled="disabled"/>
</form>
Now, I made this js, to see if one of the inputs is selected, then the disabled="disabled"
part should be revered, but that is now the case in this JavaScript code
if(document.getElementById('checkMe').checked) {
document.getElementById('choose').disabled=false;
}
Here is the online demo. http://jsfiddle.net/2HC6s/