Datepicker jquery how to diasble 2 future days after today
Spread the love

Datepicker jquery how to diasble 2 future days after today

<html>
    <head>
        <meta charset="utf-8">
        <meta https-equiv="X-UA-Compatible" content="IE=edge">
        <title>Pay Fees</title>
        <!--date picker -->
        <link href="https://code.jquery.com/ui/1.9.2/themes/smoothness/jquery-ui.css" rel="stylesheet" />
        <script src="https://code.jquery.com/jquery-1.8.3.min.js"></script>
        <script src="https://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>

       <!--date picker -->
       <script type="text/javascript">
           $(document).ready(function() {
            var today = new Date();
               var dd = today.getDate()+1;
               var dd2 = today.getDate()+2;
               
               var mm = today.getMonth()+1; 
               var yyyy = today.getFullYear();

               nextday = yyyy+'-'+mm+'-'+dd;
               nextday2 = yyyy+'-'+mm+'-'+dd2;

               unavailableDates = [nextday,nextday2];
               
               $("#datepicker").datepicker({
                   beforeShowDay: function(date){
                     var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
                     return [ unavailableDates.indexOf(string) == -1 ]
                   }
               });
           });
       </script>
    </head>
    <body>
        <input type="text" id= "datepicker" name="datepicker">
    </body>
</html>
Facebook Comments Box

Leave a Reply