存在两个
<select id="minWarnValue ">
<select id="carTypeSel ">
点击 minWarnValue 可对应筛选 carTypeSel 的值
如果使用了bootstrap,筛选后需调用
$('#carTypeSel ').selectpicker('render');
$('#carTypeSel ').selectpicker('refresh');
//筛选下拉框方法1 start
var opts = $('#carTypeSel option').map(function () {
return [[this.value, $(this).text()]];
});
function loadWarnValue_(){
var word = $("#minWarnValue option:selected").text();
word = "预警值"+word +",";
var rxp = new RegExp(word, 'i');
var optlist = $('#carTypeSel').empty();
opts.each(function (i) {
if (rxp.test(this[1])) {
optlist.append($('<option/>').attr('value', this[0]).text(this[1]));
}
});
}
//筛选下拉框方法1 end
//筛选下拉框方法2 start
var _option=$("#carTypeSel option");
function loadWarnValue(){
return;
var word = $("#minWarnValue option:selected").text();
word = "预警值"+word +",";
$("#carTypeSel option").remove();
_option.each(function(i){
if($(this).text().indexOf(word)>=0){
$("#carTypeSel").append($(this));
}
});
}
//筛选下拉框方法2 end