1
有大量的問題和答案,但我找不到我在找什麼。無法隱藏jQuery UI的日期選擇器
我顯示的日期選擇器鏈接點擊,但不能隱藏它時,用戶選擇一個日期。如果您有任何建議,請讓我知道。您可以在http://jsfiddle.net/5qE8K/
$("#calendar > a").unbind('click').bind('click', function(e){
e.preventDefault();
var calendar = $(this).parent();
$("#content").datepicker({
beforeShow: function(){
$(".ui-datepicker").css({
'position' : 'absolute',
'top' : (calendar.offset().top + calendar.height() + 4) + 'px',
'left' : (calendar.offset().left + calendar.width() - $(".ui-datepicker").outerWidth(true)) + 'px'
});
},
onSelect: function(date, obj){
calendar.children("div#selected-date").text(obj.selectedDay + '/' + (obj.selectedMonth+1) + '/' + obj.selectedYear);
calendar.children("span").text(obj.selectedDay);
$("#content").datepicker('hide');
}
});
});
請提供一個jsfiddle測試用例.. – Nelson
嘿尼爾森,我添加了jsfiddle鏈接。謝謝。 – Tim