JSFiddle - React, Tailwind, and code Playground
HTML
<label for="month">Month: </label>
<input type="text" id="month" name="month" class="monthPicker" />
JavaScript
$(document).ready(function(){
$(".monthPicker").datepicker({
dateFormat: 'mm',
changeMonth: true,
changeYear: true,
onChangeMonthYear: function(dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).val($.datepicker.formatDate('M', new Date(year, month, 1)));
}
});
$(".monthPicker").focus(function () {
$(".ui-datepicker-calendar").hide();
$("#ui-datepicker-div").position({
my: "center top",
at: "center bottom",
of: $(this)
});
});
});