0
我已经把这里演示:http://jsfiddle.net/JjBPd/的jQuery的onchange输球选中状态
$(function() {
var options = $("select#areafilter").children("option");
var selectoption = $("select#regionfilter");
$(selectoption).on("change", function() {
var selected = $(this).children("option:selected").data("path");
$(options).appendTo("select#areafilter");
$(options).each(function() {
var region = $(this).data("region");
if (region != selected && region != 'default') {
$(this).remove();
}
});
if (selected == 'default') {
$(options).appendTo("select#areafilter");
}
});
});
基本上,如果你选择一个区域,然后选择和区域,然后按区域再次选择过滤器,它加载与的最后一个选项突出显示选择列表,我尝试使用selected ='selected'并重点关注,但没有喜悦。
感谢您抽出宝贵的时间,在Firefox :( – user989952 2013-04-30 02:50:19
你是正确的回答,遗憾的是仍然不工作!它确实* *在Chrome/Safari浏览器的工作,但是这很有趣... – 2013-04-30 02:56:03
真棒非常感谢你的帮助 :) – user989952 2013-04-30 03:15:29