最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to autoclose and click icon datepicker bootstrap - Stack Overflow

programmeradmin0浏览0评论

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:

<script>
   $('#cid').datepicker();
</script>

Exactly I have done insert jquery and datepicker 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.

Thanks

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:

<script>
   $('#cid').datepicker();
</script>

Exactly I have done insert jquery and datepicker 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.

Thanks

Share Improve this question edited Apr 9, 2014 at 8:59 BENARD Patrick 31k16 gold badges102 silver badges108 bronze badges asked Oct 29, 2013 at 8:28 johnjohn 551 gold badge1 silver badge6 bronze badges 1
  • The thing is, datepicker by default should close upon clicking a date, is there not any JavaScript errors in the console? – MackieeE Commented Oct 29, 2013 at 12:51
Add a ment  | 

1 Answer 1

Reset to default 5

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;

发布评论

评论列表(0)

  1. 暂无评论