javascript - Making radio buttons that are named differently, act as if they were in a group -


I have a dynamically-form form - it has many fields with its own elements; Button is a simplified snippet here:

  & lt; Form name = "ePIC" method = "post" action = "test.php" & gt; & Lt; Fieldset & gt; & Lt; Input type = "radio" name = "pic [1]" /> & Lt; / Fieldset & gt; & Lt; Fieldset & gt; & Lt; Input type = "radio" name = "photo [2]" /> & Lt; / Fieldset & gt; & Lt; Input type = "submit" name = "submit" value = "test" /> & Lt; / Form & gt;  

Basically, the fields have pictures and the selection of the cover image for the radio button album.

Everything is doing a great job except this fact, because the radio buttons are named differently, they will not function as a group - that is, sometimes the radio button is selected at one time. can go.

Can anyone tell me how the radio buttons work as a group, maybe javascript / jquery?

I started trying to manage buttons by class - but lost on the other hand, how to affect all other radio buttons.

This jQuery code will remove the part of the [n] all radio button names , Hence all etter ('name', function (i, name) {$ (this). Data ('original-name', name); return name. Location (/), '');};

Use this submit handler to retain the original name with the index when the form is submitted.

  $ ("attry ('name', function) (return $ (this). Data ('original-name');});});  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -