たとえば、ラジオボタン 1 = 値 1、ラジオボタン 2 = 値 2 です。
ここに私が持っているコードがあります:
スクリプト ファイル:
<script type="text/javascript">
$(document).ready(function () {
$("div[data-role='footer']").prepend('<a href="#" data-rel="back" data-icon="back">Back</a>');
$(".Next").click(function () {
$.mobile.changePage("#" + $("#Answer").val());
});
$("input[type=radio]").click(function () {
var answer = $(this).val();
$("#Answer").val(answer);
});
$('.Answer').live("click", function () {
var NextQuestionID = $(this).attr('NextQuestionId');
if (NextQuestionID == '') {
location.href = "/Surveys/Index";
}
$("#survey").load('/Questions/GetQuestion', { Id: NextQuestionID }, function () {
$('#answerInput').textinput();
$(".Answer").button();
});
});
});
ここに私のマークアップがあります:
<input type="radio" name="Answer" id="radio-choice-1" value="Question2" />
<input id="Answer" class="Answer" type="hidden" value="first" />
<div class="innerspacer">
<a href="" class="Next" data-theme="d" data-role="button">Next</a>
</div>
ラジオ ボタンに 1 から 4 の値を割り当て、すべての質問の値を合計するにはどうすればよいですか?