user3107610
user3107610

Reputation: 77

How to disable a radio button if another button is unchecked

Ho to make the button unclick able except after checked one of radio button? Please Help Me!

I HAve tried code below :

if(!radiobutton.isChecked){
  button.setVisible(false);
}

But its not help me.. anyone can solve my problem?

Upvotes: 0

Views: 2393

Answers (3)

DurgaPrasad9v
DurgaPrasad9v

Reputation: 19

Hi you can disable other radio buttons if one is selected by giving same name attribute to all radio buttons.

<input type = "radio" name = "tiger"><label>Option A</label>
<input type = "radio" name = "tiger"><label>Option B</label>
<input type = "radio" name = "tiger"><label>Option C</label>

If you chose option A,other radio buttons will be deactivated.

Upvotes: 1

Jyoti Prakash
Jyoti Prakash

Reputation: 1260

Try this out

  <div>
     <input type="checkbox" id="checkit" />
     <input type="button" value="click"  id="click" />
  </div>

Js:

        var check = $("#checkit");

       $("#checkit").on('click',checkStatus);

            function checkStatus(){

              if(check.is(':checked'))
                {
                   $("#click").prop('disabled', true);
                 }
             else{
                   $("#click").prop('disabled', false);
                }

             }

http://jsfiddle.net/c6Az2/

Upvotes: 0

Hitesh
Hitesh

Reputation: 3498

If you want to make the button unclickable, try

button.Enabled = false;

Upvotes: 0

Related Questions