I am having weird problem. I want to have jQuery UI DatePicker with a Dropdown of date format.
I found this, and tested and working fine on page load. However, same code is not working when I load the page via ajax call.
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type="text/javascript">
$( function() {
$( "#id_management_date" ).datepicker();
$( "#id_management_date_format" ).on( "change", function() {
alert(3);
$( "#id_management_date" ).datepicker( "option", "dateFormat", $( this ).val() );
});
} );
</script>
On loading the ajax content, I am able to select the calendar. But when I change the format dropdown, it's not formatting date in datepicker.