Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- $('.datepicker').datepicker({
- changeMonth: true,
- changeYear: true,
- showButtonPanel: true,
- dateFormat: 'mm/yy',
- onClose: function(dateText, inst) {
- var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
- var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
- $(this).datepicker('setDate', new Date(year, month, 1));
- },
- beforeShow: function(input, inst) {
- if ((datestr = $(this).val()).length > 0) {
- year = datestr.substring(datestr.length - 4, datestr.length);
- //month = jQuery.inArray(datestr.substring(0, datestr.length - 5), $(this).datepicker('option', 'monthNames'));
- month = datestr.substring(0, datestr.length - 5);
- $(this).datepicker('option', 'defaultDate', new Date(year, month-1, 1));
- $(this).datepicker('setDate', new Date(year, month-1, 1));
- }
- }
- });
- $("#datepicker").mousedown(function() {
- $('#ui-datepicker-div').toggle();
- });
- });
- $("#datepicker").mousedown(function() {
- $('#ui-datepicker-div').toggle();
- });
Add Comment
Please, Sign In to add comment