finding the value of radio button with jquery
Posted
by oo
on Stack Overflow
See other posts from Stack Overflow
or by oo
Published on 2010-05-07T15:40:16Z
Indexed on
2010/05/07
15:48 UTC
Read the original article
Hit count: 144
jQuery
|radiobutton
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?
© Stack Overflow or respective owner