javascript - Check-in / Check-out date loading issue in Bootstrap Calendar -
from below code if click on check-in date june 17th 2014 , calendar directly popup check-out calendar may 18th 2014 need calendar popup show june 17th 2014. can me , below code.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="js/bootstrap-datepicker.js" type="text/javascript"></script> <script> $(document).ready(function(e) { var nowtemp = new date(); var = (nowtemp.getmonth()+1)+'-'+ nowtemp.getdate()+'-'+ nowtemp.getfullyear(); $('#sandbox-container .input-append.date').datepicker({ orientation: "auto", autoclose: true, todayhighlight: true, startdate:now }).on('changedate', function(ev) { $('#sandbox-container1 span').trigger('click'); $('.input-append.date.span12').css({display:'block'}).show(); }); var nowtemp1 = new date(); var now1 = (nowtemp1.getmonth()+1)+'-'+ (nowtemp1.getdate()+1)+'-'+ nowtemp1.getfullyear(); $('#sandbox-container1 .input-append.date').datepicker({ orientation: "auto", autoclose: true, startdate:now1 }); }); </script>
<div id="sandbox-container" class="book_arriv_input f-left"> <div data-date-format="mm-dd-yyyy" data-date="12-12-2013" id="dp1" class="input-append date" > <input type="text" id="check_in" name="checkin_date_avail" class="span6"/> <span> <div class="add-on calender" style="margin-left: -5px;"> <i class="icon-th"></i> </div> </span> </div> </div>
<div id="sandbox-container1" class="book_arriv_input f-left"> <div data-date-format="mm-dd-yyyy" data-date="12-13-2013" id="dp2" class="input-append date"> <input type="text" id="check_out" name="checkout_date_avail" class="span6"><span class="add-on calender" style="margin-left: -5px;"><i class="icon-th"></i></span> </div> </div>
the second date disabled on 17th because now1 starts 1 day after. can use instead of now1. edit: can set date on checkout picker based on checkin picker this:
picker1 = $('#sandbox-container1 .input-append.date').datepicker() picker1.data('datepicker').setdate(pickeddate);
fiddle: http://jsfiddle.net/tp2mp/
Comments
Post a Comment