2012-05-20 301 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()将该对象转换为其他字符串格式,或使用对象自己的方法来提取数字值。

相关问题