onClose and datepick with jQuery
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);
}
});
精彩评论