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'后看到了什么? –