Home > other >  Jquery Datepicker not rhiding past dates
Jquery Datepicker not rhiding past dates

Time:11-08

Am using Jquery Datepicker for my project . If i want to change date format my code will be

$( "#datepicker1" ).datepicker({
  dateFormat: "dd-mm-yy"
});

Its not working . But if am using this format its working

$("#datepicker1").datepicker("setDate", ' 1d');

Please provide me a solution . Thanks in Advance

CodePudding user response:

To disable all previous dates, give start date as today date

startDate: new Date()

$(function() {
    $( "#datepicker" ).datepicker({ 
      format: 'dd/mm/yyyy',
      startDate: new Date(),
    });
 });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datepicker/0.6.5/datepicker.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/datepicker/0.6.5/datepicker.min.css" rel="stylesheet"/>


<div> Select Date <input type="text" id="datepicker" /></div>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related