twitter-bootstrap 如何自动关闭并单击图标日期选择器引导程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19653108/
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
How to autoclose and click icon datepicker bootstrap
提问by john
I have problem with code:
我有代码问题:
<div class="control-group input-append date">
<label class="control-label" for="cid">Check In</label>
<div class="controls">
<input class="span8 required" name="cid" type="text" id="cid">
<span class="add-on"><i class="icon-calendar"></i></span>
</div>
</div>
and the javascript:
和javascript:
<script>
$('#cid').datepicker();
</script>
Exactly I have done insert jqueryand datepicker javascript.
正是我已经完成了插入jquery和datepicker javascript。
Problem:
问题:
The date can't auto close. I want to after click date, the table date will autoclose.
The icon calender can't click. I want to if user click icon calender beside form input, the table calender will showing.
日期不能自动关闭。我想点击日期后,表格日期将自动关闭。
图标日历无法点击。我想如果用户点击表单输入旁边的图标日历,表格日历将显示。
Thanks
谢谢
回答by BENARD Patrick
Can you try :
你能试一下吗 :
$('.datepicker tbody').on('click', function(){ $('.datepicker').hide() });
$('.icon-calendar').on('click', function(){?$('.datepicker').toggle()???});
You have to precise the jquery selector in case where you have multi icon calendar or datepicker;
如果您有多个图标日历或日期选择器,您必须精确设置 jquery 选择器;

