Question

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!

Was it helpful?

Solution

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

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top