我正在使用 ddslick(jquery 插件)在我的页面上创建两个 json 下拉列表:
var DataComms = [
{
text: "7000C",
value: 1,
selected: false,
imageSrc: "images/7000C.jpg"
},
{
text: "6000",
value: 2,
selected: false,
imageSrc: "images/6000.jpg"
},
{
text: "5000",
value: 3,
selected: false,
imageSrc: "images/6900.jpg"
}
];
var DataEquip = [
{
text: "PMD",
value: 1,
selected: false,
imageSrc: "images/PMD.jpg"
},
{
text: "SD",
value: 4,
selected: false,
imageSrc: "images/sd.jpg"
}
];
$('#DropdownComms').ddslick({
data:DataComms,
width:300,
selectText: "Communicators",
imagePosition:"right",
onSelected: function(data){
//callback function: do something with selectedData;
}
});
$('#DropdownOtherEquip').ddslick({
data:DataOtherEquip,
width:300,
selectText: "Other Equipment",
imagePosition:"right",
onSelected: function(selectedData){
//callback function: do something with selectedData;
}
});
我正在尝试找到一种方法,当从一个下拉列表中进行任何选择时,onSelected 函数应将另一个下拉列表“重置”回其初始状态(显示其原始的“selectText”。目前,如果我进行选择在下拉菜单 1 中,然后从下拉菜单 2 中进行选择,下拉菜单 1 仍然显示我在其中所做的选择。
我试过 $('#DropdownComms').ddslick('close'); 这是行不通的。我也试过 $('#DropdownComms').ddslick('select', {index: 0}); 这也不起作用。
关于如何重置的任何想法?
谢谢!