Reputation: 185
I am using datepicker to have month and year only as dropdown to select.
When i am using below CSS to disable the days of the datepicker, it is disabling the other datepickers in my JSP.
1.How can i make this css inline to one desired datepicker alone.
.ui-datepicker-calendar {
display: none;
}
2.once after disabling i am using onselect to select the month and year which is not working but it works if i select day in calendar with full calendar.
$(document).ready(function() {
$('#txtDate').datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'M yy',
yearRange: "-2:+0",
defaultDate: '-1m',
onSelect: function() {
var iMonth = $("#ui-datepicker-div .ui-datepicker-month :selected").text();
var iYear = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
callmymethod();
}
});
});
pls help me with these 2 queries. Thank you
Upvotes: 0
Views: 823
Reputation: 185
i have got the solution for this which exactly served my purpose
<input type="text" data-calendar="false" />
<input type="text" data-calendar="false" />
<input type="text" data-calendar="true" />
jQuery
$('input').datepicker({
beforeShow: function(el, dp) {
$('#ui-datepicker-div').toggleClass('hide-calendar', $(el).is('[data-calendar="false"]'));
}
});
CSS
.hide-calendar .ui-datepicker-calendar {
display: none;
}
Upvotes: 1