У меня есть группа переключателей. Как я могу получить, что проверено yes или now для каждой группы и добавить их в массив?Как установить значение переключателей в jQuery mobile?
Вот что я придумал до сих пор:
Моего код JQuery:
<script type="text/javascript">
$(function() {
$("#getinfo").click(function() {
$("input[name*=radio-choice-1]:checked").each(function() {
alert($(this).val());
});
});
});
</script>
и радио кнопки
<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">
<input type="radio" name="radio-choice-1" id="radio-choice-1" value="choice-1" />
<label for="radio-choice-1">Yes</label>
<input type="radio" name="radio-choice-1" id="radio-choice-2" value="choice-2" />
<label for="radio-choice-2">No</label>
</fieldset>
<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">
<input type="radio" name="radio-choice-3" id="radio-choice-3" value="choice-3" />
<label for="radio-choice-3">Yes</label>
<input type="radio" name="radio-choice-3" id="radio-choice-4" value="choice-4" />
<label for="radio-choice-4">No</label>
</fieldset>
<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">
<input type="radio" name="radio-choice-5" id="radio-choice-5" value="choice-5" />
<label for="radio-choice-5">Yes</label>
<input type="radio" name="radio-choice-5" id="radio-choice-6" value="choice-6" />
<label for="radio-choice-6">No</label>
</fieldset>
<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">
<input type="radio" name="radio-choice-7" id="radio-choice-7" value="choice-7" />
<label for="radio-choice-7">Yes</label>
<input type="radio" name="radio-choice-7" id="radio-choice-8" value="choice-8" />
<label for="radio-choice-8">No</label>
</fieldset>
<a href="#" id="getinfo">getinfo</a>
Ваше предупреждение не работает? Или вы не смущены тем, как их помещать в массив? – prodigitalson
Прости, что я не был достаточно ясен. Мое предупреждение не работает – Steven