我有3个单选按钮。我想刷新我的网页每次点击第1个单选按钮(即sel_address)。每当用户点击选定的地址页面应刷新。我不希望页面刷新点击其他2个单选按钮。我可以如何做到这一点?第一个单选按钮点击刷新页面
<label class="option sel_address">
<input type="radio" value="sel_address" name="delivery_option" checked="checked" id="sel_address">
</label>
<strong>selected address</strong>
<label class="option your_school">
<input type="radio" value="your_school" name="delivery_option" id="your_school">
</label>
<strong>school</strong>
<label class="option rhs_showroom">
<input type="radio" value="showroom" name="delivery_option" id="showroom">
</label>
<strong>Showroom</strong>
<script type="text/javascript">
$("input[name='delivery_option']").click(function() {
.
.
var delivery_value = $(this).val();
if(delivery_value == "your_school" || delivery_value == "showroom"){
//some code
}else{
..
}
}
看看到':first'选择:https://api.jquery.com/first-selector/ – BeNdErR