Bootstrap 日期选择器在选择后隐藏 [英] Bootstrap datepicker hide after selection
本文介绍了Bootstrap 日期选择器在选择后隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
选择日期后如何隐藏日历?有我可以使用的特定功能吗?我的代码如下:
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('hide')
方法在选择后隐藏 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');
});
更新
这是 autoclose: true
的错误.此错误已在最新的 master 中修复.查看 COMMIT.从 GitHub<获取最新代码/a>
This was the bug with autoclose: true
. This bug was fixed in latest master. SEE THE COMMIT. Get the latest code from GitHub
这篇关于Bootstrap 日期选择器在选择后隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文