0

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

4

1 回答 1

0

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>

于 2021-11-08T05:53:23.003 回答