$(".datepicker").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'yy-mm-dd',
yearRange: '1800:2100',
onSelect: function(value, ui) {
}
});
$('.yearmonth').datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'yy-mm',
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));
}
});
.yearmonth .ui-datepicker-calendar {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
Year and Month : <input class="yearmonth" type="text" /><br>
Complete Date : <input class="datepicker" type="text" />
How can I have 2 datepicker in one context that will have a full date and the other will have only month and year?
Tried hiding using CSS but I cant determine how select the datepicker that is only for month and year
What I want is when I click on year month the calendar should be hidden.