Reputation: 949
Following is my code,
$(document).ready(function () {
$("#es").hide();
$("#n").hide();
$('input[type="radio"]').click(function () {
if (this.value === "Yes")
$("#es").show();
else if (this.value === "No")
$("#n").show();
});
});
There are 2 radio buttons for yes and no.After selecting yes if select no only no option should be selected but here both buttons are getting selecte.How can i rectify this?
Upvotes: 3
Views: 149
Reputation: 184
You need to group the radio buttons.
Give same names to the radio buttons to do so.
Upvotes: 0
Reputation: 1792
try this :
give same name both of radio button like this
<input type="radio" name="radio" value="Yes">Yes
<input type="radio" name="radio" value="no">No
Upvotes: 1