Hi,
I have two radio buttons, when a radio button gets clicked i want to know the selected radio button index location. The code below, for the first radio button it gives 0. For the second, it gives -1 which is wrong.
<input checked="checked" class="subTypeSelector" id="VolumeSelected" name="SubType" type="radio" value="2" />
<input class="subTypeSelector" id="DiscussOptions" name="SubType" type="radio" value="3" />
jquery
$(".subTypeSelector").click(function () {
var $radioChecked = $(".subTypeSelector:checked");
var $radio = $(".subTypeSelector");
var index = $radioChecked.index($radio);
alert(index);
});
I am following the following here:
http://stackoverflow.com/questions/2475564/jquery-radiobutton-index