I totally agree with @Corbin I would like to provide a complete example to help someone in detail.
If you want the jQueryui default calendar to be open, also record the click event for the calendar, follow these steps:
HTML code:
<div id="myDatePicker" class="DateBox datepicker" style="width:100%;height:200px;"></div> <input type="hidden" id="dateHidden" name="dateHidden" />
and your script should look like this:
<script> $( function() { $( ".datepicker" ).datepicker({ altField: "#dateHidden", dateFormat: 'yy-mm-dd'}) .datepicker("setDate", "0"); } ); </script>
and you can get the selected date value, for example, the following code:
<script> $("#dateHidden").on('input propertychange paste', function(){ var Loc = $("#Cafe").val(); var PDate = $("#dateHidden").val(); </script>
source share