<div class="custom-select" style="width:200px;">
<select>
<option value="0">Select Language:</option>
<option value="1">HTML</option>
<option value="2">RUBY</option>
</select>
</div>
选中一个选择框后,不能编辑另一个选择框
<div class="custom-select" style="width:200px;">
<select>
<option value="0">Select Language:</option>
<option value="1">HTML</option>
<option value="2">RUBY</option>
</select>
</div>
不能选择上面的选择菜单。
这应该有帮助。 但是,您需要JQuery来实现这一点。
null
$('select[name=select1]').on('change', function() {
$('select[name=select2]').prop("disabled", true);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="custom-select" style="width:200px;">
<select name="select1">
<option selected disabled value="0">Select Language:</option>
<option value="1">HTML</option>
<option value="2">RUBY</option>
</select>
</div>
<div class="custom-select" style="width:200px;">
<select name="select2">
<option value="0">Select Language:</option>
<option value="1">HTML</option>
<option value="2">RUBY</option>
</select>
</div>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>