I want to be able to have a yes or a no selection option for each question and then I will use c# to get that selected value. Not sure how to do modify jquery code to work with more radio buttons...Anyone guide me please? Thanks!
<label
class
=
"label_radio r_on"
for
=
"radio-01"
>
<input
name
=
"sample-radio"
id
=
"radio-01"
value
=
"1"
type
=
"radio"
checked
=
""
/>
Yes.
</label>
<label
class
=
"label_radio"
for
=
"radio-02"
>
<input
name
=
"sample-radio"
id
=
"radio-02"
value
=
"2"
type
=
"radio"
/>
No.
</label>
<script>
function setupLabel() {
if ($('.label_radio input').length) {
$
('.label_radio').each(function () {
$
(this).removeClass('r_on');
});
$
('.label_radio input:checked').each(function () {
$
(this).parent('label').addClass('r_on');
});
};
};
$
(document).ready(function () {
$
('.label_check, .label_radio').click(function () {
setupLabel
();
});
setupLabel
();
});
</script>