twitter-bootstrap 要求 Bootstrap 日期选择器始终处于打开模式
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28622555/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Require Bootstrap date picker always in open mode
提问by Ajoshi
How can i get Require Bootstrap date picker always in open mode?
如何获得始终处于打开模式的 Require Bootstrap 日期选择器?
I am using bootstrap date picker in one of my application.
我在我的应用程序之一中使用引导程序日期选择器。
Requirement is like date picker should be open when page load and it should be always in open mode after selection as well.
要求就像日期选择器应该在页面加载时打开,并且在选择后也应该始终处于打开模式。
I found that it can manageable through autoclose: false property but, if i click out side of date picker it's getting close.
我发现它可以通过 autoclose: false 属性进行管理,但是,如果我单击日期选择器的外侧,它会越来越近。
It should be there always in open mode.
它应该始终处于打开模式。
I hope there is any property which can make it possible, Please find following function which i am using.
我希望有任何属性可以使它成为可能,请找到我正在使用的以下功能。
HTML
HTML
<input type="text" id="select_date" class="selecteShipDate" />
Script
脚本
<script src="assets/js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
$(function () {
$('#select_date').datepicker({
format: 'dd MM yyyy',
autoclose: false
})
});
</script>
回答by Awad Maharoof
Have a look at Mark Amery's answer. This should work for you too.
看看 Mark Amery 的回答。这也应该对你有用。
$(document).ready(function () {
$input = $("#select_date");
$input.datepicker({
format: 'dd MM yyyy'
});
$input.data('datepicker').hide = function () {};
$input.datepicker('show');
});
I here is a working demo
我这里是一个工作演示
回答by Shumik
$('#datepicker').datepicker();
$('#datepicker').on('changeDate', function() {
$('#my_hidden_input').val(
$('#datepicker').datepicker('getFormattedDate')
);
});
<div id="datepicker" data-date="12/03/2012"></div>
<input type="hidden" id="my_hidden_input">

