Is there a way to use a variable in the name= parameter.
I would like to be able to do:
var a = 1;
$("#gen_p").html($("input:radio[name='gen'+a]:checked").val()));
I am able to do $("#gen_p"+a) but not in the [name=??]
Have I missed something?
Thanks
$("#gen_p").html($("input:radio[name='gen"+a+"']:checked").val());
You're mixing some single quotes in there.
EDIT: You were also having some extra ) in there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With