1
這是實際的內容。在下面的代碼中,在用戶界面中添加了兩次下拉值。顯示下拉值「AprilApril」,而不是「四五」在jquery中設置的值,增加了兩倍相同的值
if ($('#dk_container_selectToYear .dk_options li.dk_option_current a').text() == 2016) {
var currentdate = new Date();
var month = currentdate.getMonth();
var monthname = monthLookup[currentdate.getMonth()];
month = month + 3;
while (month <= 13) {
$('#dk_container_selectToMonth .dk_options li:nth-child(' + month + ')').css({ "display": 'none' });
var listvalue = $('#dk_container_selectToMonth .dk_options li:nth-child(' + month + ')').text();
if ($('#dk_container_selectToMonth .dk_options li.dk_option_current a').text() == listvalue) {
$('#selectToMonth').dropkick('reset');
$('#selectToMonth').dropkick('setValue', monthname);
}
month++;
}
}
$('#selectToMonth').dropkick('setValue', monthname);
是否有任何其他選項,以避免它..
在此先感謝..
monthLookup是什麼樣子的? – Coss
如果你在設置好控制檯日誌'monthname'後看到了什麼? –