-1
var currentYear;
while (i < months.length) {
annualMonths.push("<h4>" + months[i] + "</h4><span id='monthDates'><ul class='datum monthselection'>" + daysInMonth(i, currentYear) + "</ul></span><br>");
//$(".monthName").replaceWith("<h4>" + months[i] + "</h4><span id='monthDates'><ul class='datum monthselection'>" + daysInMonth(i, currentYear) + "</ul></span><br>");
i++;
}
$("#calendar .currentYear .monthName").html(annualMonths);
i =1;
此功能显示一年中所有月份的所有编号天数。如何替换元素的数组,而不是在jQuery中的函数调用他们加入他们?
问题是,我希望每次调用该函数来替换现有数据,而不是在DOM末尾加入连接。
这怎么可能?
尝试,但遗憾的是不工作! – Naser
@Naser更新代码。尝试一次。 –
它工作!非常感谢! – Naser