html:
[HTML] 纯文本查看 复制代码 <div class="mb-3">
<select class="form-select">
<option id="xsa" selected>选择模式</option>
<option id="xsclv" value="0">1</option>
<option id="xaclv" value="0">2</option>
</select>
</div>
<form>
<div class="sclv" style="display: none;">
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">1</span>
<input type="text" class="form-control" placeholder="12" aria-label="title"
aria-describedby="basic-addon1">
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">1</span>
<input type="text" class="form-control" placeholder="12"
aria-label="title" aria-describedby="basic-addon1">
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">1</span>
<input type="text" class="form-control" placeholder="12"
aria-label="title" aria-describedby="basic-addon1">
</div>
</div>
<div class="aclv" style="display: none;">
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">2</span>
<input type="text" class="form-control" placeholder="23" aria-label="title"
aria-describedby="basic-addon1">
</div>
<div class="input-group mb-3">
<span class="input-group-text" id="basic-addon1">2</span>
<input type="text" class="form-control" placeholder="23" aria-label="title"
aria-describedby="basic-addon1">
</div>
</div>
</form>
jQuery代码:
[JavaScript] 纯文本查看 复制代码 <script type="text/javascript">
$(function () {
$("#xsa").click(function(){
$(".sclv").hide();
$(".aclv").hide();
});
$("#xsclv").click(function(){
$(".sclv").show();
$(".aclv").hide();
});
$("#xaclv").click(function(){
$(".sclv").hide();
$(".aclv").show();
});
});
</script>
选择1会显示sclv,选择2会显示aclv
火狐浏览器可以正常运行,chrome或edge就不行,也不会报错
|