[英]Jquery UI datepicker, onclick of a date , get the date and pass to URL
我在事件頁面(sharepoint頁面)中有一個jquery UI datepicker日歷。
$('#datepicker').datepicker();
一旦用戶點擊任何日期並獲得該日期並將其作為mypage.aspx?dt = 1/12/2012傳遞給頁面網址,我需要獲取日期。我有這個但不能正常工作。
$('.ui-datepicker td a').click(function(){
var url=$(location).attr('href');
var date = $(this.datepicker( "getDate" ));
if(date != 'null')
url += '&dt=' + date;
window.location.href=url;
});
這也不起作用..
$('.ui-datepicker td a').click(function() {
window.location.href = 'http://mysite/events/Pages/default.aspx?dt=' + $('#datepicker').datepicker().val();
});
有人可以幫忙嗎?
嘗試
$('#datepicker').datepicker({
onSelect: function(dateText, inst) {
window.location = 'http://mysite/events/Pages/default.aspx?dt=' + dateText;
}
});
使用onSelect
事件( 此處記錄 )
允許您在選擇日期選擇器時定義自己的事件。 該函數接收所選日期作為文本,並將datepicker實例作為參數接收。 這指的是相關的輸入字段。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.