我有一个单选按钮组,我想选择所选按钮之一。从选定的单选按钮中选择下一个单选按钮
$(document).ready(function() {
$('.next').click(function() {
$("input[name=choice]:checked").next().click();
});
});
.button {
display: inline-block;
padding: 1em;
margin: 20px;
border: 1px solid black;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="radio" id="choise_1" name="choice" checked="checked" />
<label for="choise_1">One</label>
<input type="radio" id="choise_2" name="choice" />
<label for="choise_2">Two</label>
<input type="radio" id="choise_3" name="choice" />
<label for="choise_3">Three</label>
<div class="button next">SELECT NEXT</div>
这是我有,但它是不工作
难道你不觉得'.prop('checked',true)'比'.click()'更好吗? – Rayon
@RayonDabre是的,没错。应该是,而不是点击。 – Jai
太好了,谢谢你的解释! – chiapa