2012-05-20 367 views
0

http://keith-wood.name/datepick.html日期選擇日月年

,但我可以看到的唯一事情就是天的月份取的整個時間警報

$(function() { 
    $('#popupDatepicker').datepick(); 
    $('#inlineDatepicker').datepick({onSelect: showDate}); 
}); 

function showDate(date) { 
    alert('The date chosen is ' + date); 
} 

我想知道如何使他們分頭喜歡

<input type="text" name="date" id="popupDatepicker"> When i select date here the fields in the hidden will change below 
<input type="hidden" name="day"> 
<input type="hidden" name="month"> 
<input type="hidden" name="year"> 

請告知

回答

0

與日期選取器的問題處理程序是將日期作爲字符串使用的任何格式傳遞給日期選擇器。

您可以使用$('#inlineDatepicker').datepicker('getDate')來獲取代表所選日期的實際Date對象。

您也可以使用$.datepicker.formatDate()將該對象轉換爲其他字符串格式,或使用對象自己的方法來提取數字值。

相關問題