答案 0 :(得分:1)
请参见下面的实时示例:
$('#sector option[value=temp]').hide();
$('#sector').change(function() {
$('#sector option[value=temp]').show();
$("#sector option[value=temp]").css("font-size", "small");
});
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<div class="form-group">
<label for="sector">Sector</label>
<div class="label form-label-group">
<select class="form-control" id="sector">
<option disabled value="temp">Sector</option>
<option value="Civilian">Civilian</option>
<option value="Officer">Officer</option>
<option value="Retirement">Retirement</option>
</select>
</div>
</div>