views:

47

answers:

2

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?

+1  A: 

@name='exerciseRB' should be name=exerciseRB ie:

$("input[name=exerciseRB]:checked")
mkoryak
+1  A: 

You don't need the @ before name in your selector.

rosscj2533