Disabling and enabling button submit based on radio input conditions

how to disable a button in jquery based on condition
jquery enable button by id
javascript enable submit button after validation
how to disable a button in html based on condition
jquery disable button click event
disable/enable submit button until all forms have been filled
javascript disable button onclick
disable button if input is empty javascript

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/

Try this | demo

<form method="POST" id="question">
    <input type='radio' name='a' value='a' id='checkMe' onclick="check()"/> a 
    <input type='radio' name='a' value='b' id='checkMe1' onclick="check()" /> b  
    <input type='radio' name='a' value='c' id='checkMe2' onclick="check()" /> c    
</br>

function check()
{
var ele = document.getElementsByName('a');
var flag=0;
for(var i=0;i<ele.length;i++)
{
    if(ele[i].checked)
     flag=1;

} 
if(flag==1)
document.getElementById('choose').disabled=false;
}

Enable/Disable Radio Button Using jQuery, Learn how to enable & disable radio buttons in an HTML form by using jQuery. an option to enable or disable some information based on user point of view, 

<!DOCTYPE html>
<html>
<head>
    <title>Stack</title>
    <script>
    function set_btn_status() 
    {
       var radios = document.getElementsByName("a");

        for (var i = 0; i < radios.length; i++) {       
            if (radios[i].checked) {
                var checked_value = radios[i].value;
                if(checked_value == 'a') {
                    document.getElementById('choose').disabled = false;
                } else {
                    document.getElementById('choose').disabled = true;
                }
                break;
            }

        }
    }
    </script>
</head>
<body>
<form method="POST">
    <input type='radio' name='a' value='a' id='checkMe' onclick="set_btn_status()"/> a 
    <input type='radio' name='a' value='b' id='checkMe1'  onclick="set_btn_status()"/> b  
    <input type='radio' name='a' value='c' id='checkMe2'   onclick="set_btn_status()"/> c    
    <input type='submit' value='choose' id='choose' disabled="disabled"/>    
</form>
</body>
</html>

jQuery disable button, Using jQuery to disable a button has many advantages as it will allow you to enable and disable the button based on user interaction. You will <input type='​submit' name='submit' id='submitBtn' class='enableOnInput' disabled='disabled' /​>.

Put it inside a table and then do on her:

var tabPom = document.getElementById("pomTableId");
$(tabPom ).prop('disabled', true/false);

Disable or Enable Submit Button using JavaScript disabled Property, showing how to disable or enable a submit button based on certain condition. I'll use the Input element's disabled property to set it disabled (or un-clickable). Related Article: Disable or Enable Checkbox Depending upon Dropdown 

<form method="POST" id="question">
    <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    
</br>
    <input type='submit' value='choose' id='choose' disabled="disabled"/>    
</form>

<script>
document.getElementById('checkMe').onclick = function() {
   document.getElementById('choose').disabled=false;
} 
</script>

Disable radio buttons after selection, So the subject title pretty much says what I'd like to do, after I select a radio button I want to lock all other options so that you cannot change your answer.

HTML DOM Input Radio disabled Property, Input Radio disabled Property. ❮ Input Radio Object. Example. Disable a radio button: document.getElementById("cats") 

Disable a button until a checkbox is checked., In this tutorial, I will show you how to disable a HTML button until a checkbox is checked. sort of Terms and Conditions checkbox that the user must tick before they can sign up. We have added an inline event handler to the checkbox input​. //JavaScript function that enables or disables a submit button depending //on 

Custom script to disable radio buttons depending on a selected one, Hey guys! Is it possible to extend that little script with a condition?For example:If I check Option 1 then Option 2 is disabled.I'm not really into 

Comments
  • you cannot have the same ID for several elements
  • And how am I supposed to check if it is selected or not?
  • In the future, when you give javascript/HTML/css answers to people, you should first test it here. jsfiddle.net As for now, I am giving you +1 just for the effort
  • just used to on click function with id