I have a datepicker
which I want to show the current date whenever the page loads but when I am doing it with simple input field it is working but the datepicker
input field not taking the values
$('#deliveryDate').datepicker({
format: 'dd/mm/yyyy',
});
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var month = new Array();
month[0] = "01";
month[1] = "02";
month[2] = "03";
month[3] = "04";
month[4] = "05";
month[5] = "06";
month[6] = "07";
month[7] = "08";
month[8] = "09";
month[9] = "10";
month[10] = "11";
month[11] = "12"; //January is 0!
var mm = month[today.getMonth()];
var yyyy = today.getFullYear();
today = dd + '/' + mm + '/' + yyyy;
console.log(today)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gijgo@1.9.6/js/gijgo.min.js" type="text/javascript"></script>
<link href="https://cdn.jsdelivr.net/npm/gijgo@1.9.6/css/gijgo.min.css" rel="stylesheet" type="text/css" />
<label for="deliveryDate" id="commonHeader"> Delivery Date:</label>
<input type="text" id="deliveryDate" name="deliveryDate" width="176" />
Now I am getting todays date in variable today
now I want to store that value in datepicker input field when the page loads.