I'm using jQuery UI - v1.12.1 datepicker for an input field created dynamically, the datepicker is working but I cannot change the date format.
This is how I'm initializing the picker
$('body').on('focus',"#datepicker", function(){
$(this).datepicker("option", "dateFormat", "yy-mm-dd");
});
Thanks in advance
Try this code ! It might help you!
$(document).ready(function () {
$('body').on('focus', "#datepicker", function () {
$("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' });
});
});