Tuesday, February 23, 2016

Date picker for checkIn and checkout according to given condition

 var dateToday = new Date();
 
$(document).ready(function() {
$("#checkin").datepicker({
numberOfMonths: 1,
minDate:dateToday,
todayBtn:"linked",
todayHighlight: true,
onSelect:function(selected){
var dt=new Date(selected);
dt.setDate(dt.getDate()+1);
$("#checkout").val(dt.getMonth()+1+"/"+dt.getDate()+"/"+dt.getFullYear());
$("#checkout").datepicker("option","minDate",dt);

}
}) ;
$("#checkout").datepicker({
    numberOfMonths: 1,
minDate:dateToday,
todayBtn:"linked",
onSelect:function(selected){
var dt=new Date(selected);
dt.setDate(dt.getDate()-1);
$("#checkin").datepicker("option","maxDate",dt);
}
});
$('.ui-datepicker').addClass('notranslate');


        });

No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...