finding the value of radio button with jquery
- by oo
i have this code below to show different divs when i choose certain radio buttons:
if ($("input[@name='exerciseRB']:checked").val() == 'New') {
$("#newExercise").show();
$("#existingExercise").hide();
}
else {
$("#newExercise").hide();
$("#existingExercise").show();
}
at first, i just had two radio buttons (both named exerciseRB and everything works fine.
Now, later in my web page i added two new radio buttons (with the name lessonRB).
The issue is that once i added these other new radio buttons when i look up this in firebug:
$("input[@name='exerciseRB']:checked")
i actually get an array back with both the exerciseRB item as well as the lessonRB item. Its almost as if the
@name='exerciseRB'
is being ignored. any ideas here?