<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script type="text/javascript" src="./js/jquery-3.5.1.js"></script>
</head>
<body>
<input class="netStatusAfter" type="radio" name="hobbys" value="normal" id="normal" checked="checked"> 正常
<input class="netStatusAfter" type="radio" name="hobbys" value="abnormal" id="abnormal"> 异常
<!-- <input type="radio" name="bedStatus" id="allot" checked="checked" value="allot">正常
<input type="radio" name="bedStatus" id="transfer" value="transfer">异常 -->
<hr>
<input class="fdkResult" id="Radio1" type="radio" name="complete" value="完成" checked="checked"> 完成
<input class="fdkResult" id="Radio2" type="radio" name="complete" value="取消"> 取消
<input class="fdkResult" type="radio" name="complete" value="失败"> 失败
</body>
<script>
$(document).ready(function() {
$('input[type=radio][name=hobbys]').change(function() {
if (this.value == 'normal') {
$("#Radio1").prop('checked', true);
} else if (this.value == 'abnormal') {
$("#Radio2").prop('checked', true);
}
});
});
</script>
</html>
radio单选框,当改变选中值,修改其他radio默认值
最新推荐文章于 2023-08-25 10:15:20 发布