1 回答
TA贡献1796条经验 获得超10个赞
这非常有效,请试试这个:-->
<select id="category_cabinet" name="category_cabinet" class="form-control" onchange="change_cabinet_search(this.value)">
<option value="0">Please Select</option>
<option value="658">100-PENTADBIRAN</option>
<option value="659">200-PENGURUSAN TANAH & BANGUNAN</option>
<option value="660">300-PENGURUSAN ASET</option>
<option value="661">400-PENGURUSAN KEWANGAN</option>
<option value="662">500-PENGURUSAN SUMBER MANUSIA</option>
<option value="663">100-1-PENTADBIRAN/PERUNDANGAN</option>
<option value="664">100-2-PENTADBIRAN/PERHUBUNGAN AWAM</option>
<option value="679">516-JOHN</option><option value="680">516-1-JOHN/DAVID</option>
</select>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#category_cabinet option').each(function(k,v){
var number=$(v).text().split('-')[0];
console.log(number,$(v).text());
if(number >= 100 && number <= 299){
console.log("remove");
$(v).remove();
}
});
});
</script>
- 1 回答
- 0 关注
- 118 浏览
添加回答
举报