这是我的例子
<fieldset data-role="controlgroup" id="test">
<legend>Radio buttons, vertical controlgroup:</legend>
<input class="status" type="radio" name="radio-choice-1" id="radio-choice-1" value="choice-1" checked="checked">
<label for="radio-choice-1">Cat</label>
<input class="status" type="radio" name="radio-choice-1" id="radio-choice-2" value="choice-2">
<label for="radio-choice-2">Dog</label>
<input class="status" type="radio" name="radio-choice-1" id="radio-choice-3" value="choice-3">
<label for="radio-choice-3">Hamster</label>
<input class="status" type="radio" name="radio-choice-1" id="radio-choice-4" value="choice-4">
<label for="radio-choice-4">Lizard</label>
</fieldset>
$('.status').on("click", function () {
var inputs = $('#test').find('input');
$.each(inputs, function (i, v) {
console.log(v);
});
});
我想获得所有单选按钮中的id
和,例如:val()
[{
id: id1,
value: value1
} {
id: id2,
value: value2
}]
...
有任何想法吗?