1

I was wondering if there is a way where i have i 2 groups of radio button eg

group 1

<input type="radio" name="things" value="car" /> car <input type="radio" name="things" value="car" />pen <input type="radio" name="things" value="car" />TV 

group2

<input type="radio" name="things" value="exam" /> exam <input type="radio" name="things" value="journey" />journey 

the question is if i select radio button from group2 Eg exam it should deactivate radio butons car And Tv from group1 and allow only pen radio button active

0

2 Answers 2

2

Modifying your HTML a bit

<div id="grp1"> <input type="radio" name="things" value="car" /> car <input type="radio" name="things" value="pen" />pen <input type="radio" name="things" value="tv" />TV </div> <div id="grp2"> <input type="radio" name="things" value="exam" /> exam <input type="radio" name="things" value="journey" />journey </div> $(function(){ $("#grp2 input:radio[name='things']").change(function(){ $("#grp1 input:radio[name='things'][value!='pen']").attr("disabled", true); }); }); 

See a working demo

Sign up to request clarification or add additional context in comments.

1 Comment

hEy Thanks Rahul Your solution really worked.Thanks once again!!
0
$("input[value="exam"]").click(function() { $("input[value=\"car\"").attr("disabled", "disabled"); }); 

This should disable the "car" input when the exam radio button is clicked.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.