Shir Gans
Shir Gans

Reputation: 2027

getting a radio button dynamically with jquery

I have tried this for too long... too big for me. I need a little help here. I have a page with products. each product got 3 sizes (normal, big, special) The user is selecting radio button to choose the size and then hits the "add to cart".

I am trying to get the value he chose, but without any success. Right now I found that jQuery is almost working for me.

If i write this down:

selected_val = $("input[name='sizeof75']:checked").val();

I am getting to right value of group named sizeof75. But since it changes dynamically, i am looking for a way to migrate the field name into this. I mean something like this:

selected_val = $("input[name='"+field_name+"']:checked").val();

any help will be aprreciated.

Thank you

Upvotes: 0

Views: 241

Answers (1)

Shir Gans
Shir Gans

Reputation: 2027

Sorry,

this question is not relevant... just had a syntax problem...

Upvotes: 1

Related Questions