簡體   English   中英

日期選擇日月年

[英]Date Pick Day Month Year

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">

請指教

日期選擇器的onselect處理程序的問題是,使用您在日期選擇器上放置的任何格式,將日期作為字符串傳遞。

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM