我在下面的鏈接下面用datepicker製作了'月份日曆'。 當我點擊按鈕,日曆出來,並顯示月和年。這是我的問題。任何人都知道如何改變這個命令在jQuery日期選擇器中改變月份和年份之間的位置
從1.month 2.year到1.year 2.month
http://develop-for-fun.blogspot.kr/2013/08/jquery-ui-datepicker-month-and-year.html
$(function() {
$('#MainContent_txtMonth').datepicker({
changeYear: true,
changeMonth: true,
showButtonPanel: true,
dateFormat: 'yy-mm',
monthNamesShort: ['1월','2월','3월','4월','5월','6월','7월','8월','9월','10월','11월','12월'],
showOn: "button",
buttonImage: "img/button_calendar.jpg",
buttonImageOnly: true
}).focus(function() {
var thisCalendar = $(this);
$('.ui-datepicker-calendar').detach();
$('.ui-datepicker-close').click(function() {
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
thisCalendar.datepicker('setDate', new Date(year, month, 1));
});
});
});
你爲什麼不改變生成的HTML? – Kosmog 2015-02-23 08:00:01
@Kosmo生成的HTML有** 2個選擇標記**並且具有**'onchange'event **。我不知道如何更改生成的標籤。 – naanace 2015-02-23 08:14:22
我已經發布了一個答案 – Kosmog 2015-02-23 08:23:13