Bootstrap datepicker隐藏选择后 [英] Bootstrap datepicker hide after selection
本文介绍了Bootstrap datepicker隐藏选择后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何选择日期后如何隐藏日历?有可以使用的具体功能吗?我的代码如下:
How do I hide the calendar after a date is selected? Is there a specific function that I can use? My code below:
$('#dp1').datepicker({
format: 'mm-dd-yyyy',
startDate: '-15d',
autoclose: true,
endDate: '+0d' // there's no convenient "right now" notation yet
});
任何帮助将不胜感激。
推荐答案
您可以使用事件 changedate()
跟踪日期与 datepicker('隐藏')
方法在选择后隐藏 datepicker
You can use event changedate()
to keep track of when the date is changed together with datepicker('hide')
method to hide the datepicker
after making selection:
$('yourpickerid').on('changeDate', function(ev){
$(this).datepicker('hide');
});
更新
这是bug与 autoclose:true
。这个错误是在最新的主人中修复的。查看 COMMIT 。从 GitHub
This was the bug with autoclose: true
. This bug was fixed in latest master. SEE THE COMMIT. Get the latest code from GitHub
这篇关于Bootstrap datepicker隐藏选择后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文