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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 19:00:50  来源:igfitidea点击:

How to autoclose and click icon datepicker bootstrap

javascriptjquerytwitter-bootstraptwitter-bootstrap-2

提问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.

正是我已经完成了插入jquerydatepicker javascript

Problem:

问题:

  1. The date can't auto close. I want to after click date, the table date will autoclose.

  2. The icon calender can't click. I want to if user click icon calender beside form input, the table calender will showing.

  1. 日期不能自动关闭。我想点击日期后,表格日期将自动关闭。

  2. 图标日历无法点击。我想如果用户点击表单输入旁边的图标日历,表格日历将显示。

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 选择器;