Display the date that was selected with Jquery

Display the date that was selected with Jquery

  1. I have a date picker as below which is not bringing back the date that was picked by the user, instead it is bringing back the latest month and the year. How can i change the function so that it always brings back the date that was saved in the database or the date that was selected. 

  2. thanks 


  3. <script>

  4. $(document).ready(function () {
  5. $(".datepicker").datepicker({
  6. showOn: 'both',
  7. dateFormat: 'dd-mm-yy',
  8. showButtonPanel: true,
  9. constrainInput: false,
  10. buttonImage: "../jquery-ui-1.11.4.custom/images/calendarNew.gif",
  11. buttonText:"Please select a date",
  12. buttonImageOnly: true,
  13. closeText: 'Clear', // Text to show for "close" button
  14. onClose: function () {
  15. var event = arguments.callee.caller.caller.arguments[0];
  16. // If "Clear" gets clicked, then really clear it
  17. if ($(event.delegateTarget).hasClass('ui-datepicker-close')) {
  18. $(this).val('');
  19. }
  20. }
  21. });
  22. });
  23.     </script>



As you can see above today's date is picked instead of reverting back to June 23.