views:

51

answers:

3

HTML:

form
  input:radio 1
  input:radio 2
  input:radio 3

If one of these is clicked, I'd like to disable the rest. I think siblings selector will be used here but I can't figure out how.

Thanks for your help!

A: 

you can use simple javascript + HTML dom for doing this.

radio button events: http://www.hscripts.com/tutorials/javascript/dom/radio-events.php

use a javascript function to be activated on onClick event

Idlecool
A: 

it's kind of odd that radio buttons actually have the same selection-state. That should only be possible by grouping.

Anyway to accomplish that task do

$('input:radio').change(function(){
    $(this).siblings(':radio').removeAttr('selected');
});
jAndy
+1  A: 

I think you're trying to disable the others, and for that you need to set the disabled=disabled attribute of the radio input.

$("input:radio").click(function() {
  $(this).siblings("input:radio").attr("disabled","disabled");
});

Example Here: http://jsbin.com/oquse/2 View/Edit Code Here: http://jsbin.com/oquse/2/edit

Sandro