Guest User

Untitled

a guest
Jan 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. $(function() {
  2. $('.datepicker').datepicker({
  3. changeMonth: true,
  4. changeYear: true,
  5. showButtonPanel: true,
  6. dateFormat: 'mm/yy',
  7. onClose: function(dateText, inst) {
  8. var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
  9. var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
  10. $(this).datepicker('setDate', new Date(year, month, 1));
  11. },
  12. beforeShow: function(input, inst) {
  13. if ((datestr = $(this).val()).length > 0) {
  14. year = datestr.substring(datestr.length - 4, datestr.length);
  15. //month = jQuery.inArray(datestr.substring(0, datestr.length - 5), $(this).datepicker('option', 'monthNames'));
  16. month = datestr.substring(0, datestr.length - 5);
  17. $(this).datepicker('option', 'defaultDate', new Date(year, month-1, 1));
  18. $(this).datepicker('setDate', new Date(year, month-1, 1));
  19. }
  20. }
  21. });
  22. $("#datepicker").mousedown(function() {
  23. $('#ui-datepicker-div').toggle();
  24. });
  25. });
  26.  
  27. $("#datepicker").mousedown(function() {
  28. $('#ui-datepicker-div').toggle();
  29. });
Add Comment
Please, Sign In to add comment