我有一段正在使用的代码,并且有一个插件用于设置选择框的样式,所以它已经很糟糕了。
我正在破坏元素,以便当我从#searchbrand 中选择某些东西时,它会过滤掉它是什么#searchmodel。但是,当此触发时,我无法将元素重建为以前的样式。
$("#searchbrand").change(function() {
var _class = $('option:selected', this).attr('class');
$('#searchmodel option').hide().filter(function() {return $(this).attr('class') == _class;}).show();
$('#searchmodel').selectBox('destroy');
});