javascript - JQueryUI radio buttonset not selecting mulitiple sections -


In my HTML page, I get two sections, each with the other independent when I am selecting 1 in Czech and then Choice 2 is selected unselected and only choice 4 is selected, I have to choose 2 more choice 4.

HTML

  & lt; Div id = "radio-gp1" & gt; & Lt; Input type = "radio" id = "radio 1" name = "radio" /> & Lt; Label = "radio1" & gt; Option 1 & lt; / Label & gt; & Lt; Input type = "radio" id = "radio2" name = "radio" /> & Lt; Label = "radio2" & gt; Choice 2 & lt; / Label & gt; & Lt; / Div & gt; & Lt; Div id = "radio-gp2" & gt; & Lt; Input type = "radio" id = "radio3" name = "radio" /> & Lt; Label = "radio3" & gt; Choice 3 & lt; / Label & gt; & Lt; Input type = "radio" id = "radio 4" name = "radio" /> & Lt; Label = "radio4" & gt; Choice 4 & lt; / Label & gt; & Lt; / Div & gt; & Lt; Button ID = "Check 1" & gt; Check 1 & lt; / Button & gt; & Lt; Button ID = "Check 2" & gt; Check 2 & lt; / Button & gt;  

JS

  $ (function () {$ ("# radio-gp1") .buttonset (); $ ("# Radio-GP2") .buttonset (); $ ('# check1'). Click (function () {$ ('# radio-gp1 input'). Each (function () {$ (this ) .attr ('check', 'check'); $ ("# radio-gp1"). Buttons set ('refresh');});}); $ ('# check2'). ) {$ ('# Radio-GP2 input'). Each (function () {$ (this) .attr ('checked', 'checked'); $ ("# radio-gp2") .buttonset ('refresh ');});});});  

Not sure where I am going, my bela is

You can not select multiple of the radio with the same name attribute. You would like to name your groups separately.

  & lt; Div id = "radio-gp1" & gt; & Lt; Input type = "radio" id = "radio 1" name = "radiopop 1" /> & Lt; Label = "radio1" & gt; Option 1 & lt; / Label & gt; & Lt; Input type = "radio" id = "radio2" name = "radiogp1" /> & Lt; Label = "radio2" & gt; Option 2 & lt; / Label & gt; & Lt; / Div & gt; & Lt; Div id = "radio-gp2" & gt; & Lt; Input type = "radio" id = "radio3" name = "radiog2" /> & Lt; Label = "radio3" & gt; Choice 3 & lt; / Label & gt; & Lt; Input type = "radio" id = "radio4" name = "radiogp2" /> & Lt; Label = "radio4" & gt; Choice 4 & lt; / Label & gt; & Lt; / Div & gt;  

Comments