开发者

onClose and datepick with jQuery

开发者 https://www.devze.com 2022-12-25 14:37 出处:网络
I have the following code: $(\'#popupDatepickerWeekly\').datepick({ maxDate:\'1Y\', mandatory:true, highlightWeek:true,

I have the following code:

$('#popupDatepickerWeekly').datepick({
   maxDate:'1Y',
   mandatory:true,
   highlightWeek:true,
   onClose: closedDate
});

My closedDate function looks like this:

function clo开发者_如何学GosedDate(value, date, inst) { 
 document.signUpForm.repeatUntil.value = value;
}

But when I pick a date using the datepicker, the repeatUntil hidden value is not set.

The hidden form field looks like this:

<input type="hidden" name="repeatUntil" value="">

I don't get an error or anything, but it always comes back as an empty string.


Try changing your closedDate function to this:

function closedDate(value, date, inst) { 
 $("input[name=repeatUntil]").val(value);
}

Or use an anonymous function like this:

$('#popupDatepickerWeekly').datepick({
   maxDate:'1Y',
   mandatory:true,
   highlightWeek:true,
   onClose: function(value) { 
     $("input[name=repeatUntil]").val(value);
   }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消