I am trying to do a survey but I have designed it without any radio box. So I decided to highlight selection with a different background color, everything is done with jquery.
I did not set the display of radio boxes to anyone so that they would not be shown, every single unique ID Here's the script.
& lt; Form action = "v_poll.php" method = "post" & gt; & Lt; Ul class = "polling" & gt; & Lt; Li class = "voting ballot" & gt; & Lt; Input type = "radio" name = "poll" value = "a1" style = "display: none;" ID = "A1" & gt; & Lt; One onClick = "Vote ('A1')" Answer 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "ballot ballot" & gt; Input type = "radio" name = "vote" value = "A2" style = "display: none;" Id = "A2" & gt; & Lt; One onClick = "vote ('A2')" & gt; Answer 2 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "poll ballot" & gt; Input type = "radio" name = "vote" value = "A3" style = "display: none;" Id = "A3" & gt; & Lt; One onClick = "vote ('A3')" & gt; Answer 3 & lt; / A & gt; & Lt; / Li & gt; & Lt; Input type = "hidden" value = "1" name = "id" /> & Lt; Input type = "submit" value = "submit" & gt; & Lt; / Ul & gt; & Lt; / Form & gt; & Lt; Script type = "text / javascript" & gt; Function Vote (TheValue) {GetElementById (TheValue) Checked = true; } & Lt; / Script & gt;
But when I checked the value of the radio box with $ _POST ['poll'] then it is empty, is not doing anything wrong in the fixed price radio box?
Please help please.
You can do it without javascript, with for = "id" / Code> Instead of
& lt; Li class = "voting vote" & gt; & Lt; Input type = "radio" name = "vote" value = "A1" style = "display: none;" Id = "a1" & gt; & Lt; Label = "a1" & gt; Answer 1 & lt; / Label & gt; & Lt; / Li & gt;
This is nothing new / html5 or nothing, any browser IE6 +, and possibly older will support this.
Comments
Post a Comment