Reputation: 1325
I am working with the datepicker from jQuery-UI and I was wondering if there was anyway to disable/modify the calendar for it to only display month and year and only that.
I tried the answer here jQuery UI Datepicker - Disable specific days, but it did not quite do what I wanted. It was not really working and the I wanted to disable specific datepicker not all of them.
Can someone help at all with this?
Thanks in advance.
PS: so far my code looks like this:
$(".crud_date_picker_month").datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'yy-mm'
});
jQuery UI version 1.8.21
The can see code here: http://jsfiddle.net/VJADH/
Upvotes: 0
Views: 2096
Reputation: 22339
I was wondering if there was anyway to disable/modify the calendar for it to only display month and year and only that.
To only display month and year using CSS:
.ui-datepicker-calendar{
display:none;
}
DEMO - Only show Month/Year using CSS
If you need to do it programmatically you can add the following code:
$(".date-picker").focus(function () {
$(".ui-datepicker-calendar").hide();
});
DEMO - Only show Month/Year programmatically
Upvotes: 3
Reputation: 4130
To disable the month and year (as per your submission title!!), hide the header:
.ui-datepicker-header {
display: none;
}
Upvotes: 0