eozzy
eozzy

Reputation: 68740

On check, disable all others

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!

Upvotes: 1

Views: 2066

Answers (2)

Sandro
Sandro

Reputation: 4771

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

Upvotes: 3

Shiv Deepak
Shiv Deepak

Reputation: 3126

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

Upvotes: 0

Related Questions